public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug debug/113481] New: avr: internal compiler error in decompose, at rtl.h:2298
@ 2024-01-18 13:52 gjl at gcc dot gnu.org
  2024-01-18 13:54 ` [Bug debug/113481] [14 Regession] " gjl at gcc dot gnu.org
                   ` (10 more replies)
  0 siblings, 11 replies; 12+ messages in thread
From: gjl at gcc dot gnu.org @ 2024-01-18 13:52 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 113481
           Summary: avr: internal compiler error in decompose, at
                    rtl.h:2298
           Product: gcc
           Version: 14.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: debug
          Assignee: unassigned at gcc dot gnu.org
          Reporter: gjl at gcc dot gnu.org
  Target Milestone: ---

Created attachment 57139
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=57139&action=edit
C test case from gcc.target/avr/torture

I see this ICE with current compiler from master with an avr test case:

$ avr-gcc -g -O3 -std=gnu99 -mmcu=atmega128 pr109907-2.c -S

The ICE goes away when I remove the -g switch.

Target: avr
Configured with: ../../source/gcc-master/configure --target=avr --disable-nls
--with-dwarf2 --with-gnu-as --with-gnu-ld --disable-shared
--with-fixed-point=no --with-long-double=64 --enable-languages=c,c++
Thread model: single
Supported LTO compression algorithms: zlib
gcc version 14.0.1 20240118 (experimental) (GCC)

^ permalink raw reply	[flat|nested] 12+ messages in thread

* [Bug debug/113481] [14 Regession] avr: internal compiler error in decompose, at rtl.h:2298
  2024-01-18 13:52 [Bug debug/113481] New: avr: internal compiler error in decompose, at rtl.h:2298 gjl at gcc dot gnu.org
@ 2024-01-18 13:54 ` gjl at gcc dot gnu.org
  2024-01-18 13:58 ` gjl at gcc dot gnu.org
                   ` (9 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: gjl at gcc dot gnu.org @ 2024-01-18 13:54 UTC (permalink / raw)
  To: gcc-bugs

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

Georg-Johann Lay <gjl at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|avr: internal compiler      |[14 Regession] avr:
                   |error in decompose, at      |internal compiler error in
                   |rtl.h:2298                  |decompose, at rtl.h:2298
             Target|                            |avr
           Keywords|                            |ice-on-valid-code

--- Comment #1 from Georg-Johann Lay <gjl at gcc dot gnu.org> ---
The test uses __int24, so maybe the assertion gets something wrong with
PSImode.

^ permalink raw reply	[flat|nested] 12+ messages in thread

* [Bug debug/113481] [14 Regession] avr: internal compiler error in decompose, at rtl.h:2298
  2024-01-18 13:52 [Bug debug/113481] New: avr: internal compiler error in decompose, at rtl.h:2298 gjl at gcc dot gnu.org
  2024-01-18 13:54 ` [Bug debug/113481] [14 Regession] " gjl at gcc dot gnu.org
@ 2024-01-18 13:58 ` gjl at gcc dot gnu.org
  2024-01-18 14:22 ` rguenth at gcc dot gnu.org
                   ` (8 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: gjl at gcc dot gnu.org @ 2024-01-18 13:58 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #2 from Georg-Johann Lay <gjl at gcc dot gnu.org> ---
It does not occur with avr-gcc-v13 -fchecking

^ permalink raw reply	[flat|nested] 12+ messages in thread

* [Bug debug/113481] [14 Regession] avr: internal compiler error in decompose, at rtl.h:2298
  2024-01-18 13:52 [Bug debug/113481] New: avr: internal compiler error in decompose, at rtl.h:2298 gjl at gcc dot gnu.org
  2024-01-18 13:54 ` [Bug debug/113481] [14 Regession] " gjl at gcc dot gnu.org
  2024-01-18 13:58 ` gjl at gcc dot gnu.org
@ 2024-01-18 14:22 ` rguenth at gcc dot gnu.org
  2024-01-18 18:03 ` [Bug debug/113481] " pinskia at gcc dot gnu.org
                   ` (7 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: rguenth at gcc dot gnu.org @ 2024-01-18 14:22 UTC (permalink / raw)
  To: gcc-bugs

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

Richard Biener <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|---                         |14.0

^ permalink raw reply	[flat|nested] 12+ messages in thread

* [Bug debug/113481] avr: internal compiler error in decompose, at rtl.h:2298
  2024-01-18 13:52 [Bug debug/113481] New: avr: internal compiler error in decompose, at rtl.h:2298 gjl at gcc dot gnu.org
                   ` (2 preceding siblings ...)
  2024-01-18 14:22 ` rguenth at gcc dot gnu.org
@ 2024-01-18 18:03 ` pinskia at gcc dot gnu.org
  2024-01-18 18:32 ` gjl at gcc dot gnu.org
                   ` (6 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: pinskia at gcc dot gnu.org @ 2024-01-18 18:03 UTC (permalink / raw)
  To: gcc-bugs

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

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|[14 Regession] avr:         |avr: internal compiler
                   |internal compiler error in  |error in decompose, at
                   |decompose, at rtl.h:2298    |rtl.h:2298
           Keywords|                            |ice-checking
   Target Milestone|14.0                        |---

--- Comment #3 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Note -fchecking does not enable gcc_checking_assert checking so you will need
to configure older compilers with --enable-checking=yes to get the assert
hitting.


The assert that hits:
        gcc_checking_assert (INTVAL (x.first)
                             == sext_hwi (INTVAL (x.first), precision)
                             || (x.second == BImode && INTVAL (x.first) == 1));


What this assert is trying to make a point of is that we always sign extend
CONST_INT to HostWideInt (almost always 64bit integer) from the precision of
the mode.

^ permalink raw reply	[flat|nested] 12+ messages in thread

* [Bug debug/113481] avr: internal compiler error in decompose, at rtl.h:2298
  2024-01-18 13:52 [Bug debug/113481] New: avr: internal compiler error in decompose, at rtl.h:2298 gjl at gcc dot gnu.org
                   ` (3 preceding siblings ...)
  2024-01-18 18:03 ` [Bug debug/113481] " pinskia at gcc dot gnu.org
@ 2024-01-18 18:32 ` gjl at gcc dot gnu.org
  2024-01-18 19:08 ` gjl at gcc dot gnu.org
                   ` (5 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: gjl at gcc dot gnu.org @ 2024-01-18 18:32 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #4 from Georg-Johann Lay <gjl at gcc dot gnu.org> ---
What's strange is that it only occurs with -g.

^ permalink raw reply	[flat|nested] 12+ messages in thread

* [Bug debug/113481] avr: internal compiler error in decompose, at rtl.h:2298
  2024-01-18 13:52 [Bug debug/113481] New: avr: internal compiler error in decompose, at rtl.h:2298 gjl at gcc dot gnu.org
                   ` (4 preceding siblings ...)
  2024-01-18 18:32 ` gjl at gcc dot gnu.org
@ 2024-01-18 19:08 ` gjl at gcc dot gnu.org
  2024-01-18 20:57 ` gjl at gcc dot gnu.org
                   ` (4 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: gjl at gcc dot gnu.org @ 2024-01-18 19:08 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #5 from Georg-Johann Lay <gjl at gcc dot gnu.org> ---
Here is a somewhat reduced test:

/* { dg-do run } */
/* { dg-options "-g -O2" } */

typedef __UINT8_TYPE__ uint8_t;
typedef __uint24 uint24_t;

#define BBB 23
#define INC 1
#define VAL 0xcccccc

uint8_t Afun5 (uint24_t num)
{
  uint8_t b = 0;
  __asm ("sbrc %T1%T2 $ subi %0,%n3"
         : "+d" (b)
         : "r" (num), "n" (BBB), "n" (INC));
  return b;
}

uint8_t Cfun5 (uint24_t num)
{
  uint8_t b = 0;
  if (num & ((uint24_t) 1 << BBB))
    b += INC;
  return b;
}

int main (void)
{
  if (Afun5 (VAL) != Cfun5 (VAL))
    __builtin_abort();

  return 0;
}

^ permalink raw reply	[flat|nested] 12+ messages in thread

* [Bug debug/113481] avr: internal compiler error in decompose, at rtl.h:2298
  2024-01-18 13:52 [Bug debug/113481] New: avr: internal compiler error in decompose, at rtl.h:2298 gjl at gcc dot gnu.org
                   ` (5 preceding siblings ...)
  2024-01-18 19:08 ` gjl at gcc dot gnu.org
@ 2024-01-18 20:57 ` gjl at gcc dot gnu.org
  2024-01-18 22:22 ` [Bug middle-end/113481] " pinskia at gcc dot gnu.org
                   ` (3 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: gjl at gcc dot gnu.org @ 2024-01-18 20:57 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #6 from Georg-Johann Lay <gjl at gcc dot gnu.org> ---
This is as simple as it gets:

void Afun5 (__uint24 num)
{
  __asm volatile ("" :: "r" (num));
}

void func (void)
{
  Afun5 (0xcccccc);
}

^ permalink raw reply	[flat|nested] 12+ messages in thread

* [Bug middle-end/113481] avr: internal compiler error in decompose, at rtl.h:2298
  2024-01-18 13:52 [Bug debug/113481] New: avr: internal compiler error in decompose, at rtl.h:2298 gjl at gcc dot gnu.org
                   ` (6 preceding siblings ...)
  2024-01-18 20:57 ` gjl at gcc dot gnu.org
@ 2024-01-18 22:22 ` pinskia at gcc dot gnu.org
  2024-01-18 22:23 ` [Bug debug/113481] " pinskia at gcc dot gnu.org
                   ` (2 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: pinskia at gcc dot gnu.org @ 2024-01-18 22:22 UTC (permalink / raw)
  To: gcc-bugs

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

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Last reconfirmed|                            |2024-01-18
             Status|UNCONFIRMED                 |NEW
     Ever confirmed|0                           |1
          Component|debug                       |middle-end

--- Comment #7 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Confirmed.

(gdb) p x.first
$1 = (rtx_def *) 0x7ffff7542b50
(gdb) p debug_rtx(x.first)
(const_int 13421772 [0xcccccc])


Definitely not sign extended like it should be.

^ permalink raw reply	[flat|nested] 12+ messages in thread

* [Bug debug/113481] avr: internal compiler error in decompose, at rtl.h:2298
  2024-01-18 13:52 [Bug debug/113481] New: avr: internal compiler error in decompose, at rtl.h:2298 gjl at gcc dot gnu.org
                   ` (7 preceding siblings ...)
  2024-01-18 22:22 ` [Bug middle-end/113481] " pinskia at gcc dot gnu.org
@ 2024-01-18 22:23 ` pinskia at gcc dot gnu.org
  2024-01-18 22:30 ` pinskia at gcc dot gnu.org
  2024-01-18 22:33 ` pinskia at gcc dot gnu.org
  10 siblings, 0 replies; 12+ messages in thread
From: pinskia at gcc dot gnu.org @ 2024-01-18 22:23 UTC (permalink / raw)
  To: gcc-bugs

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

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
          Component|middle-end                  |debug

--- Comment #8 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
(note 21 19 24 (var_location num (const_int -3355444 [0xffffffffffcccccc]))
NOTE_INSN_VAR_LOCATION)


It is sign extended in the RTL.

^ permalink raw reply	[flat|nested] 12+ messages in thread

* [Bug debug/113481] avr: internal compiler error in decompose, at rtl.h:2298
  2024-01-18 13:52 [Bug debug/113481] New: avr: internal compiler error in decompose, at rtl.h:2298 gjl at gcc dot gnu.org
                   ` (8 preceding siblings ...)
  2024-01-18 22:23 ` [Bug debug/113481] " pinskia at gcc dot gnu.org
@ 2024-01-18 22:30 ` pinskia at gcc dot gnu.org
  2024-01-18 22:33 ` pinskia at gcc dot gnu.org
  10 siblings, 0 replies; 12+ messages in thread
From: pinskia at gcc dot gnu.org @ 2024-01-18 22:30 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #9 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
This fixes the ICE but I am not 100% sure it is correct:
```
diff --git a/gcc/dwarf2asm.cc b/gcc/dwarf2asm.cc
index 6c835bafbc4..7bd9c5f8bcc 100644
--- a/gcc/dwarf2asm.cc
+++ b/gcc/dwarf2asm.cc
@@ -146,11 +146,11 @@ dw2_asm_output_data (int size, unsigned HOST_WIDE_INT
value,

   va_start (ap, comment);

-  if (size * 8 < HOST_BITS_PER_WIDE_INT)
-    value &= ~(HOST_WIDE_INT_M1U << (size * 8));
-
   if (op)
     {
+      if (size * 8 < HOST_BITS_PER_WIDE_INT)
+       value &= ~(HOST_WIDE_INT_M1U << (size * 8));
+
       fputs (op, asm_out_file);
       fprint_whex (asm_out_file, value);
     }

```

^ permalink raw reply	[flat|nested] 12+ messages in thread

* [Bug debug/113481] avr: internal compiler error in decompose, at rtl.h:2298
  2024-01-18 13:52 [Bug debug/113481] New: avr: internal compiler error in decompose, at rtl.h:2298 gjl at gcc dot gnu.org
                   ` (9 preceding siblings ...)
  2024-01-18 22:30 ` pinskia at gcc dot gnu.org
@ 2024-01-18 22:33 ` pinskia at gcc dot gnu.org
  10 siblings, 0 replies; 12+ messages in thread
From: pinskia at gcc dot gnu.org @ 2024-01-18 22:33 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #10 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Note the code in dw2_asm_output_data has been zeroing the top bits on value
since at least 2001. So I really doubt this is a new issue. It just folks are
now testing with checking enabled more it seems.

^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2024-01-18 22:33 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-01-18 13:52 [Bug debug/113481] New: avr: internal compiler error in decompose, at rtl.h:2298 gjl at gcc dot gnu.org
2024-01-18 13:54 ` [Bug debug/113481] [14 Regession] " gjl at gcc dot gnu.org
2024-01-18 13:58 ` gjl at gcc dot gnu.org
2024-01-18 14:22 ` rguenth at gcc dot gnu.org
2024-01-18 18:03 ` [Bug debug/113481] " pinskia at gcc dot gnu.org
2024-01-18 18:32 ` gjl at gcc dot gnu.org
2024-01-18 19:08 ` gjl at gcc dot gnu.org
2024-01-18 20:57 ` gjl at gcc dot gnu.org
2024-01-18 22:22 ` [Bug middle-end/113481] " pinskia at gcc dot gnu.org
2024-01-18 22:23 ` [Bug debug/113481] " pinskia at gcc dot gnu.org
2024-01-18 22:30 ` pinskia at gcc dot gnu.org
2024-01-18 22:33 ` pinskia at gcc dot gnu.org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).