On Tue, 29 Apr 2025, Christopher Bazley wrote: > Named loops (C2y) could not previously be compiled with > -O1 and -ggdb2 or higher because the label preceding > a loop (or switch) could not be found when using such > command lines. > > This could be observed by compiling > gcc/gcc/testsuite/gcc.dg/c2y-named-loops-1.c with > the provoking command line (or any minimal example such > as that cited in the bug report). > > The fix was simply to ignore the tree nodes inserted > for debugging information. > > Base commit is ae4c22ab05501940e345ee799be3aa36ffa7269a
There should be a testcase added to the testsuite (possibly one that #includes c2y-named-loops-1.c with appropriate dg-*, in particular dg-options that includes the options required to show the bug). > - else if (TREE_CODE (stmt) != CASE_LABEL_EXPR) > + else if (TREE_CODE (stmt) != CASE_LABEL_EXPR && > + TREE_CODE (stmt) != DEBUG_BEGIN_STMT) The line should be broken before &&, not after. -- Joseph S. Myers josmy...@redhat.com