gcc 12.0.0 20211219 snapshot (g:fcbf94a5be9e0c1ecad92da773a6632b86b7f70a) fails -fcompare-debug check when compiling the following testcase w/ -O1: int bar (void); int foo (int x) { int i; for (i = 0; i <= __INT_MAX__; ++i) x += bar () < (x ? 2 : 1); return x; } % gcc-12.0.0 -O1 -fcompare-debug -c ohtuq2al.c gcc-12.0.0: error: ohtuq2al.c: '-fcompare-debug' failure (length) --- ohtuq2al.c.gkd 2021-12-21 18:49:49.840375354 +0700 +++ ohtuq2al.gk.c.gkd 2021-12-21 18:49:49.891375611 +0700 @@ -75,7 +75,7 @@ (expr_list:REG_UNUSED (reg:CC 17 flags) (nil)))) (jump_insn # 0 0 3 (set (pc) - (label_ref #)) "ohtuq2al.c":10:17# {jump} + (label_ref #)) "ohtuq2al.c":10:5# {jump} (nil) -> 3) (barrier # 0 0)
Likely latent which was exposed with r9-3352-g87bd153645f393a1.
(In reply to Martin Liška from comment #1) > Likely latent which was exposed with r9-3352-g87bd153645f393a1.
(In reply to Andrew Pinski from comment #2) > (In reply to Martin Liška from comment #1) > > Likely latent which was exposed with r9-3352-g87bd153645f393a1. here is a slightly modified (just line rather than column change) which fails in GCC 8 also: int bar (void); int foo (int x) { int i; for (i = 0; i <= __INT_MAX__; ++i) x += bar () < ( x ? 2 : 1 ); return x; }
In .gimple already: -g2: [/app/example.cpp:11:5] goto <D.1986>; vs -g0: [/app/example.cpp:10:17] goto <D.1986>; -g2: <D.1986>:; # DEBUG BEGIN STMT; SAVE_EXPR <bar () < (x != 0 ? 2 : 1)>;, x = (SAVE_EXPR <bar () < (x != 0 ? 2 : 1)>) + x;; # DEBUG BEGIN STMT; ++i; # DEBUG BEGIN STMT; goto <D.1986>; vs -g0: <D.1986>:; SAVE_EXPR <bar () < (x != 0 ? 2 : 1)>;, x = (SAVE_EXPR <bar () < (x != 0 ? 2 : 1)>) + x;; ++i; goto <D.1986>;
Can it be related to PR94276?
> here is a slightly modified (just line rather than column change) which > fails in GCC 8 also: > int > bar (void); > > int > foo (int x) > { > int i; > > for (i = 0; i <= __INT_MAX__; ++i) > x += bar () < ( > x ? 2 : 1 ); > return x; > } This one started with r8-5241-g8697bf9f46f36168 which introduced -gstatement-frontiers.
Dup of the many -gstatement-frontiers -fcompare-debug issues. No idea what to do about those.
GCC 9 branch is being closed
GCC 10.4 is being released, retargeting bugs to GCC 10.5.
GCC 10 branch is being closed.
GCC 11 branch is being closed.
GCC 12 branch is being closed.