Summary: | gimple-match.c:1523:6: error: ‘GIMPLE’ was not declared in this scope | ||
---|---|---|---|
Product: | gcc | Reporter: | Uroš Bizjak <ubizjak> |
Component: | bootstrap | Assignee: | Not yet assigned to anyone <unassigned> |
Status: | RESOLVED FIXED | ||
Severity: | normal | CC: | hjl.tools, rguenth |
Priority: | P3 | ||
Version: | 5.0 | ||
Target Milestone: | 4.8.4 | ||
Host: | Target: | alphaev68-linux-gnu | |
Build: | Known to work: | ||
Known to fail: | Last reconfirmed: | 2014-12-08 00:00:00 |
Description
Uroš Bizjak
2014-12-07 18:37:35 UTC
It looks that GIMPLE is not substituted with "1", leaving following in generated gimple-match.c: ... CASE_CONVERT: { { /* #line 612 "../../gcc-svn/trunk/gcc/match.pd" */ tree captures[1] ATTRIBUTE_UNUSED = {}; captures[0] = op0; /* #line 610 "../../gcc-svn/trunk/gcc/match.pd" */ if ((GIMPLE && useless_type_conversion_p (type, TREE_TYPE (captures[0]))) || (0 && type == TREE_TYPE (captures[0]))) { if (dump_file && (dump_flags & TDF_DETAILS)) fprintf (dump_file, "Applying pattern match.pd:612, %s:%d\n", __FILE__, __LINE__); res_ops[0] = captures[0]; *res_code = TREE_CODE (res_ops[0]); return true; ... Pleae note the above "if ((GIMPLE && ...)) condition. Hmm, it definitely works on x86_64-linux. It is supposed to work via doing cpp_define (r, gimple ? "GIMPLE=1": "GENERIC=1"); cpp_define (r, gimple ? "GENERIC=0": "GIMPLE=0"); in genmatch.c which should cause 'GIMPLE' to lex as '1'. And indeed on x86_64-linux I see in gimple-match.c: /* #line 610 "/space/rguenther/src/svn/trunk/gcc/match.pd" */ if ((1 && useless_type_conversion_p (type, TREE_TYPE (captures[0]))) || (0 && type == TREE_TYPE (captures[0]))) which means libcpp is miscompiled...? I notice that stage1 seems to work for you? (In reply to Richard Biener from comment #2) > which means libcpp is miscompiled...? I notice that stage1 seems to work > for you? Yes, it is a miscompilation due to r218161. Backing out r218161 with following patch allows bootstrap to proceed to stage3: --cut here-- Index: combine.c =================================================================== --- combine.c (revision 218489) +++ combine.c (working copy) @@ -1580,7 +1580,7 @@ setup_incoming_promotions (rtx_insn *first) /* The mode and signedness of the argument as it is actually passed, see assign_parm_setup_reg in function.c. */ - mode3 = promote_function_mode (TREE_TYPE (arg), mode1, &uns1, + mode3 = promote_function_mode (DECL_ARG_TYPE (arg), mode2, &uns3, TREE_TYPE (cfun->decl), 0); /* The mode of the register in which the argument is being passed. */ --cut here-- One of several testsuite failures (with non-bootstrapped compiler) is: FAIL: gcc.c-torture/execute/20020805-1.c -Os execution test --cut here-- extern void abort (void); extern void exit (int); void check (unsigned int m) { if (m != (unsigned int) -1) abort (); } unsigned int n = 1; int main (void) { unsigned int m; m = (1 | (2 - n)) | (-n); check (m); exit (0); } --cut here-- So, the difference between trunk (+) and trunk with reverted patch (-) starts at _.214r.combine, where "check" function gets miscompiled: 4: NOTE_INSN_BASIC_BLOCK 2 2: NOTE_INSN_DELETED 3: NOTE_INSN_FUNCTION_BEG - 6: r71:DI=zero_extend($16:SI) - REG_DEAD $16:DI + 6: NOTE_INSN_DELETED 7: r73:DI=0xffffffffffffffff 8: r72:DI=r73:DI 0>>0x20 REG_DEAD r73:DI REG_EQUAL 0xffffffff - 9: r74:DI=r71:DI==r72:DI + 9: r74:DI=$16:DI==r72:DI + REG_DEAD $16:DI REG_DEAD r72:DI - REG_DEAD r71:DI 10: pc={(r74:DI!=0)?L16:pc} REG_DEAD r74:DI REG_BR_PROB 9996 This results in an asm code difference, where needed SI->DI zero_extend is missing: @@ -18,7 +18,6 @@ lda $1,-1($31) lda $30,-16($30) .cfi_def_cfa_offset 16 - zapnot $16,15,$16 srl $1,32,$1 stq $26,0($30) .cfi_offset 26, -16 I propose to revert H.J.'s patch for PR64037. On Tue, 9 Dec 2014, ubizjak at gmail dot com wrote:
> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64213
>
> --- Comment #4 from Uroš Bizjak <ubizjak at gmail dot com> ---
> One of several testsuite failures (with non-bootstrapped compiler) is:
>
> FAIL: gcc.c-torture/execute/20020805-1.c -Os execution test
>
> --cut here--
> extern void abort (void);
> extern void exit (int);
>
> void check (unsigned int m)
> {
> if (m != (unsigned int) -1)
> abort ();
> }
>
> unsigned int n = 1;
>
> int main (void)
> {
> unsigned int m;
> m = (1 | (2 - n)) | (-n);
> check (m);
> exit (0);
> }
> --cut here--
>
> So, the difference between trunk (+) and trunk with reverted patch (-) starts
> at _.214r.combine, where "check" function gets miscompiled:
>
> 4: NOTE_INSN_BASIC_BLOCK 2
> 2: NOTE_INSN_DELETED
> 3: NOTE_INSN_FUNCTION_BEG
> - 6: r71:DI=zero_extend($16:SI)
> - REG_DEAD $16:DI
> + 6: NOTE_INSN_DELETED
> 7: r73:DI=0xffffffffffffffff
> 8: r72:DI=r73:DI 0>>0x20
> REG_DEAD r73:DI
> REG_EQUAL 0xffffffff
> - 9: r74:DI=r71:DI==r72:DI
> + 9: r74:DI=$16:DI==r72:DI
> + REG_DEAD $16:DI
> REG_DEAD r72:DI
> - REG_DEAD r71:DI
> 10: pc={(r74:DI!=0)?L16:pc}
> REG_DEAD r74:DI
> REG_BR_PROB 9996
>
> This results in an asm code difference, where needed SI->DI zero_extend is
> missing:
>
> @@ -18,7 +18,6 @@
> lda $1,-1($31)
> lda $30,-16($30)
> .cfi_def_cfa_offset 16
> - zapnot $16,15,$16
> srl $1,32,$1
> stq $26,0($30)
> .cfi_offset 26, -16
>
> I propose to revert H.J.'s patch for PR64037.
Agreed and approved. Please make sure to re-open bugs that were
fixed by the patch.
Author: uros Date: Tue Dec 9 14:34:32 2014 New Revision: 218516 URL: https://gcc.gnu.org/viewcvs?rev=218516&root=gcc&view=rev Log: PR bootstrap/64213 Revert: 2014-11-28 H.J. Lu <hongjiu.lu@intel.com> PR rtl-optimization/64037 * combine.c (setup_incoming_promotions): Pass the argument before any promotions happen to promote_function_mode. testsuite/ChangeLog: PR bootstrap/64213 Revert: 2014-11-28 H.J. Lu <hongjiu.lu@intel.com> PR rtl-optimization/64037 * g++.dg/pr64037.C: New test. Removed: trunk/gcc/testsuite/g++.dg/pr64037.C Modified: trunk/gcc/ChangeLog trunk/gcc/combine.c trunk/gcc/testsuite/ChangeLog Author: uros Date: Tue Dec 9 14:40:40 2014 New Revision: 218517 URL: https://gcc.gnu.org/viewcvs?rev=218517&root=gcc&view=rev Log: PR bootstrap/64213 Revert: 2014-11-28 H.J. Lu <hongjiu.lu@intel.com> PR rtl-optimization/64037 * combine.c (setup_incoming_promotions): Pass the argument before any promotions happen to promote_function_mode. testsuite/ChangeLog: PR bootstrap/64213 Revert: 2014-11-28 H.J. Lu <hongjiu.lu@intel.com> PR rtl-optimization/64037 * g++.dg/pr64037.C: New test. Removed: branches/gcc-4_9-branch/gcc/testsuite/g++.dg/pr64037.C Modified: branches/gcc-4_9-branch/gcc/ChangeLog branches/gcc-4_9-branch/gcc/combine.c branches/gcc-4_9-branch/gcc/testsuite/ChangeLog Author: uros Date: Tue Dec 9 14:44:06 2014 New Revision: 218518 URL: https://gcc.gnu.org/viewcvs?rev=218518&root=gcc&view=rev Log: PR bootstrap/64213 Revert: 2014-11-28 H.J. Lu <hongjiu.lu@intel.com> PR rtl-optimization/64037 * combine.c (setup_incoming_promotions): Pass the argument before any promotions happen to promote_function_mode. testsuite/ChangeLog: PR bootstrap/64213 Revert: 2014-11-28 H.J. Lu <hongjiu.lu@intel.com> PR rtl-optimization/64037 * g++.dg/pr64037.C: New test. Removed: branches/gcc-4_8-branch/gcc/testsuite/g++.dg/pr64037.C Modified: branches/gcc-4_8-branch/gcc/ChangeLog branches/gcc-4_8-branch/gcc/combine.c branches/gcc-4_8-branch/gcc/testsuite/ChangeLog |