https://gcc.gnu.org/bugzilla/show_bug.cgi?id=122835

--- Comment #19 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
(In reply to Linus Torvalds from comment #15)
> (In reply to Jakub Jelinek from comment #11)
> > 
> > Untested fix.
> 
> I obviously love this being fixed, but since we effectively will have to
> effectively do this "branch to local label" workaround manually in the
> kernel for the foreseeable future anyway (due to older gcc versions, but
> also due to clang), a warning option - despite the fix - would actually be
> more helpful for maintenance.
> 
> But I don't want to come across as some high-maintenance whiny little brat,
> so chalk this up as a "it would be lovely if..."

I understand that, though on the other side we usually just fix bugs when we
consider it being a bug instead of adding warnings about bugs in older compiler
versions (an important exception is ABI changes, where we have various warnings
for those).
With the patch I guess one could discover these issues with -fdump-tree-eh and
some scripting on the dump, the patch causes changes like:
-  __asm__ __volatile__ goto("jmp       %l1" :  :  :  : "l2" l2, "l3" l3);
+  __asm__ __volatile__ goto("jmp       %l1" :  :  :  : "l2" <D.2995>, "l3"
<D.2996>);
in the dump file, so scanning for asm goto with <D.[0-9]*> after 4th : would
flag that.
Although, the template can be multi-line, so it can be as well
   __asm__ __volatile__ goto("jmp       %l0


-# %l0" :  :  :  : "l1" l1);
+# %l0" :  :  :  : "l1" <D.2991>);
So, perhaps it might be easier to scan for it in -fdump-tree-eh-raw dumps,
where it shows up as
   gimple_asm <
     STRING <
     jmp        %l0


 # %l0
     >
-    LABEL: "l1" l1
+    LABEL: "l1" <D.2991>
   >
or
   gimple_asm <
     STRING <
     jmp        %l1
     >
-    LABEL: "l2" l2, "l3" l3
+    LABEL: "l2" <D.2995>, "l3" <D.2996>
   >
So, maybe just grepping for '^    LABEL: ".*<D.[0-9]*>' would do it.
It can be also redirected, like
gcc -O2 -fdump-tree-eh-raw=/dev/stdout pr122835.c  | grep '^    LABEL:
".*<D.[0-9]*>'
    LABEL: "l1" <D.2991>
    LABEL: "l2" <D.2995>, "l3" <D.2996>
    LABEL: "l4" <D.3003>, "l5" <D.3004>
Though, nothing to be used normally, perhaps some occassional CI.

Reply via email to