aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gcc/c/c-typeck.c4
-rw-r--r--gcc/testsuite/gcc.dg/pr99136.c9
2 files changed, 12 insertions, 1 deletions
diff --git a/gcc/c/c-typeck.c b/gcc/c/c-typeck.c
index 725dc51..4e6d369 100644
--- a/gcc/c/c-typeck.c
+++ b/gcc/c/c-typeck.c
@@ -10740,7 +10740,9 @@ c_finish_return (location_t loc, tree retval, tree origtype)
retval = TREE_OPERAND (retval, 0);
}
retval = c_fully_fold (retval, false, NULL);
- if (semantic_type)
+ if (semantic_type
+ && valtype != NULL_TREE
+ && TREE_CODE (valtype) != VOID_TYPE)
retval = build1 (EXCESS_PRECISION_EXPR, semantic_type, retval);
}
diff --git a/gcc/testsuite/gcc.dg/pr99136.c b/gcc/testsuite/gcc.dg/pr99136.c
new file mode 100644
index 0000000..1bd8446
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/pr99136.c
@@ -0,0 +1,9 @@
+/* PR c/99136 */
+/* { dg-do compile } */
+/* { dg-options "-w -fexcess-precision=standard" } */
+
+void
+foo (double x)
+{
+ return 1.0 / x;
+}