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

Harold Gutch <gcc_bugzilla at foobar dot franken.de> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |gcc_bugzilla at foobar dot 
franken
                   |                            |.de

--- Comment #1 from Harold Gutch <gcc_bugzilla at foobar dot franken.de> ---
(In reply to Roland Illig from comment #0)
> $ cat lex.c
> int
> lex_input(void);
> 
> int
> lex_character_constant(void);
> 
> int
> lex_character_constant(void)
> {
>         int c = lex_input();
>         if (c == 7)
>                 return c;
>         c &= 255;
>         return c == 0 ? -1 : c;
> }
> 
> $ /home/rillig/builds/sh3-tools/bin/sh--netbsdelf-gcc --version
> sh--netbsdelf-gcc (NetBSD nb1 20200907) 9.3.0
> Copyright (C) 2019 Free Software Foundation, Inc.
> 
> $ /home/rillig/builds/sh3-tools/bin/sh--netbsdelf-gcc lex.c -O1
> sh--netbsdelf-gcc: internal compiler error: Illegal instruction signal
> terminated program cc1

This is not specific to the NetBSD cross toolchain, this also happens with a
vanilla GCC built on Linux, verified with both 9.3.0 and git head.

I bisected this to commit 91f66e78cc141da77ff9e0e3c8519e1af3f26c07 ,
https://gcc.gnu.org/git/?p=gcc.git;a=blobdiff;f=gcc/config/sh/sh.md;h=e19e977087db4d5231f2276af53a42ee82bd50de;hp=2645fca47383c965715555f4750033f893ad869e;hb=91f66e78cc141da77ff9e0e3c8519e1af3f26c07;hpb=8faa81184f856447084a9ee41a63fc4be6bca572

I cannot claim to understand the details of this patch, but note that in the
second part of the diff the condition gets inverted.  Take for this the simple
case of SUBREG_P(reg) being false, then this changed from

  if (find_regno_note (curr_insn, REG_DEAD, REGNO (operands[0])) == NULL_RTX)

to

  if (find_regno_note (curr_insn, REG_DEAD, REGNO (operands[0])) != NULL_RTX)

After changing this back to "==", the test case passes for me again, and I can
run a full build of NetBSD/Dreamcast (SH3).  I have not verified however if the
built system works correctly.

Reply via email to