https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99230
Jakub Jelinek <jakub at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|UNCONFIRMED |NEW Last reconfirmed| |2021-03-01 Ever confirmed|0 |1 --- Comment #3 from Jakub Jelinek <jakub at gcc dot gnu.org> --- This can be seen also on int a, b; void fn1(int c, short d) { if (d || c) { do ; while (0); } } with -O2 --param logical-op-non-short-circuit=0 -fcompare-debug - differences in *.gimple dump: --- pr99230-2.c.006t.gimple 2021-03-01 12:46:25.715634310 +0100 +++ pr99230-2.gk.c.006t.gimple 2021-03-01 12:46:25.740634033 +0100 @@ -1,11 +1,13 @@ void fn1 (int c, short int d) { - if (d != 0) goto <D.1955>; else goto <D.1956>; - <D.1956>: - if (c != 0) goto <D.1957>; else goto <D.1958>; + # DEBUG BEGIN_STMT + if (d != 0) goto <D.1955>; else goto <D.1957>; <D.1957>: - <D.1958>: + if (c != 0) goto <D.1955>; else goto <D.1956>; <D.1955>: + # DEBUG BEGIN_STMT + # DEBUG BEGIN_STMT + <D.1956>: } I'm afraid it is the same issue as PR93786. The difference is that when shortcut_cond_expr is run, in one case then_se is false, because then_ is <nop_expr 0x7fffea1842e0 type <void_type 0x7fffea05af18 void VOID align:8 warn_if_not_align:0 symtab:0 alias-set -1 canonical-type 0x7fffea05af18 pointer_to_this <pointer_type 0x7fffea062000>> constant arg:0 <integer_cst 0x7fffea041d08 type <integer_type 0x7fffea05a000 sizetype> constant 0> pr99230-2.c:11:7 start: pr99230-2.c:11:7 finish: pr99230-2.c:11:7> but in another case is <statement_list 0x7fffea1862e0 type <void_type 0x7fffea05af18 void VOID align:8 warn_if_not_align:0 symtab:0 alias-set -1 canonical-type 0x7fffea05af18 pointer_to_this <pointer_type 0x7fffea062000>> side-effects head 0x7fffea189168 tail 0x7fffea1891c8 stmts 0x7fffea189150 0x7fffea186240 stmt <debug_begin_stmt 0x7fffea189150 type <void_type 0x7fffea05af18 void> pr99230-2.c:10:5 start: pr99230-2.c:10:5 finish: pr99230-2.c:10:6> stmt <statement_list 0x7fffea186240 type <void_type 0x7fffea05af18 void> head 0x7fffea189240 tail 0x7fffea189240 stmts 0x7fffea189228 stmt <debug_begin_stmt 0x7fffea189228 type <void_type 0x7fffea05af18 void> pr99230-2.c:11:7 start: pr99230-2.c:11:7 finish: pr99230-2.c:11:7>>> and only the latter has TREE_SIDE_EFFECTS set. In PR93786 I've tried several possibilities and had to gave up. Alex, any thoughts? Unless we want to remove the statement frontiers support, I'm not sure what else we can do, we'd need some new trees to hold just the debug statements that would preserve what exactly would be the behavior without -g. Not sure if this needs to be P1 though, the statement frontiers issues are old, and cris is not a primary or secondary target, so if we have a testcase that in the end only fails there...