summaryrefslogtreecommitdiff
path: root/gcc48-pr77767.patch
diff options
context:
space:
mode:
authorCoprDistGit <infra@openeuler.org>2024-08-01 14:23:42 +0000
committerCoprDistGit <infra@openeuler.org>2024-08-01 14:23:42 +0000
commit82711f6567ef069eebb942e382e2c3fa61fbf538 (patch)
tree22200b7326b32ca672ffb6e4ce6d19a09dc476e5 /gcc48-pr77767.patch
parent5d624aa0d36abe76a344f0593eae5cf36d083b15 (diff)
automatic import of compat-libgfortran-48openeuler24.03_LTSopeneuler23.09
Diffstat (limited to 'gcc48-pr77767.patch')
-rw-r--r--gcc48-pr77767.patch56
1 files changed, 56 insertions, 0 deletions
diff --git a/gcc48-pr77767.patch b/gcc48-pr77767.patch
new file mode 100644
index 0000000..ba80ac1
--- /dev/null
+++ b/gcc48-pr77767.patch
@@ -0,0 +1,56 @@
+2017-05-30 Jakub Jelinek <jakub@redhat.com>
+
+ Backported from mainline
+ 2016-12-21 Jakub Jelinek <jakub@redhat.com>
+
+ PR c/77767
+ * c-decl.c (grokdeclarator): If *expr is non-NULL, append expression
+ to *expr instead of overwriting it.
+
+ * gcc.c-torture/execute/pr77767.c: New test.
+
+--- gcc/c/c-decl.c
++++ gcc/c/c-decl.c
+@@ -5409,11 +5409,21 @@ grokdeclarator (const struct c_declarator *declarator,
+ if (TREE_CODE (type) == ERROR_MARK)
+ return error_mark_node;
+ if (expr == NULL)
+- expr = &expr_dummy;
++ {
++ expr = &expr_dummy;
++ expr_dummy = NULL_TREE;
++ }
+ if (expr_const_operands == NULL)
+ expr_const_operands = &expr_const_operands_dummy;
+
+- *expr = declspecs->expr;
++ if (declspecs->expr)
++ {
++ if (*expr)
++ *expr = build2 (COMPOUND_EXPR, TREE_TYPE (declspecs->expr), *expr,
++ declspecs->expr);
++ else
++ *expr = declspecs->expr;
++ }
+ *expr_const_operands = declspecs->expr_const_operands;
+
+ if (decl_context == FUNCDEF)
+--- /dev/null
++++ gcc/testsuite/gcc.c-torture/execute/pr77767.c
+@@ -0,0 +1,16 @@
++/* PR c/77767 */
++
++void
++foo (int a, int b[a++], int c, int d[c++])
++{
++ if (a != 2 || c != 2)
++ __builtin_abort ();
++}
++
++int
++main ()
++{
++ int e[10];
++ foo (1, e, 1, e);
++ return 0;
++}