public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/49487] New: Internal compiler error in AVR code
@ 2011-06-21 14:38 gandalf at winds dot org
  2011-06-21 15:28 ` [Bug target/49487] " eric.weddington at atmel dot com
                   ` (9 more replies)
  0 siblings, 10 replies; 11+ messages in thread
From: gandalf at winds dot org @ 2011-06-21 14:38 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49487

           Summary: Internal compiler error in AVR code
           Product: gcc
           Version: 4.7.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: gandalf@winds.org
                CC: eric.weddington@atmel.com
              Host: x86_64-unknown-linux-gnu
            Target: avr-unknown-none
             Build: x86_64-unknown-linux-gnu


Compiling the following function triggers an internal compiler error in (at
least) GCC versions 4.2, 4.3, 4.5 and the latest 4.7.0-20110620:

unsigned int test(unsigned int *ptr, unsigned int len)
{
  unsigned int sum=0, *p=ptr;

  while(p < ptr+len)
    sum += ({ unsigned int _x=(*p++); (_x << 8) | (_x >> 8); });

  if(__builtin_expect(len & 1, 0))
    sum += *p;

  return ~sum;
}

Compiler command and resulting output:

avr-gcc -O3 -Wall -mmcu=atmega644   -c -o test3.o test3.c
test3.c: In function 'test':
test3.c:12:1: error: could not split insn
(insn 40 38 41 (parallel [
            (set (reg:HI 20 r20 [92])
                (rotate:HI (reg/v:HI 20 r20 [orig:67 _x ] [67])
                    (const_int 8 [0x8])))
            (clobber (mem/c:QI (plus:HI (reg/f:HI 28 r28)
                        (const_int 1 [0x1])) [4 %sfp+1 S1 A8]))
        ]) test3.c:6 64 {*rotbhi}
     (nil))
test3.c:12:1: internal compiler error: in final_scan_insn, at final.c:2724

This was compiled using a cross-compiler on an x86_64 system as outlined below:

Target: avr
Configured with: ../configure --target=avr --prefix=/usr/local/avr
--disable-nls --enable-languages=c --disable-bootstrap --disable-libssp
Thread model: single
gcc version 4.7.0 20110620 (experimental) (GCC)


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

* [Bug target/49487] Internal compiler error in AVR code
  2011-06-21 14:38 [Bug c/49487] New: Internal compiler error in AVR code gandalf at winds dot org
@ 2011-06-21 15:28 ` eric.weddington at atmel dot com
  2011-06-21 15:58 ` j at uriah dot heep.sax.de
                   ` (8 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: eric.weddington at atmel dot com @ 2011-06-21 15:28 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49487

Eric Weddington <eric.weddington at atmel dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
          Component|c                           |target

--- Comment #1 from Eric Weddington <eric.weddington at atmel dot com> 2011-06-21 15:27:41 UTC ---
(In reply to comment #0)
> Compiling the following function triggers an internal compiler error in (at
> least) GCC versions 4.2, 4.3, 4.5 and the latest 4.7.0-20110620:

Could you be a bit more specific on the version numbers for 4.2, 4.3, and 4.5?

I've just tried building on 4.3.3 (WinAVR 20100110) and it compiled
successfully for -O[0123s].

<snip> 
> This was compiled using a cross-compiler on an x86_64 system as outlined below:

Could you try using a 32-bit host?


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

* [Bug target/49487] Internal compiler error in AVR code
  2011-06-21 14:38 [Bug c/49487] New: Internal compiler error in AVR code gandalf at winds dot org
  2011-06-21 15:28 ` [Bug target/49487] " eric.weddington at atmel dot com
@ 2011-06-21 15:58 ` j at uriah dot heep.sax.de
  2011-06-21 16:15 ` eric.weddington at atmel dot com
                   ` (7 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: j at uriah dot heep.sax.de @ 2011-06-21 15:58 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49487

Joerg Wunsch <j at uriah dot heep.sax.de> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |j at uriah dot heep.sax.de

--- Comment #2 from Joerg Wunsch <j at uriah dot heep.sax.de> 2011-06-21 15:57:50 UTC ---
Confirmed for current SVN trunk (r175263).

I cannot reproduce it on GCC 4.3.4.


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

* [Bug target/49487] Internal compiler error in AVR code
  2011-06-21 14:38 [Bug c/49487] New: Internal compiler error in AVR code gandalf at winds dot org
  2011-06-21 15:28 ` [Bug target/49487] " eric.weddington at atmel dot com
  2011-06-21 15:58 ` j at uriah dot heep.sax.de
@ 2011-06-21 16:15 ` eric.weddington at atmel dot com
  2011-06-21 17:18 ` gandalf at winds dot org
                   ` (6 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: eric.weddington at atmel dot com @ 2011-06-21 16:15 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49487

Eric Weddington <eric.weddington at atmel dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2011.06.21 16:15:37
     Ever Confirmed|0                           |1


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

* [Bug target/49487] Internal compiler error in AVR code
  2011-06-21 14:38 [Bug c/49487] New: Internal compiler error in AVR code gandalf at winds dot org
                   ` (2 preceding siblings ...)
  2011-06-21 16:15 ` eric.weddington at atmel dot com
@ 2011-06-21 17:18 ` gandalf at winds dot org
  2011-06-24 20:12 ` gjl at gcc dot gnu.org
                   ` (5 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: gandalf at winds dot org @ 2011-06-21 17:18 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49487

--- Comment #3 from gandalf at winds dot org 2011-06-21 17:17:20 UTC ---
(In reply to comment #1)
> (In reply to comment #0)
> > Compiling the following function triggers an internal compiler error in (at
> > least) GCC versions 4.2, 4.3, 4.5 and the latest 4.7.0-20110620:
> 
> Could you be a bit more specific on the version numbers for 4.2, 4.3, and 4.5?
> 
> I've just tried building on 4.3.3 (WinAVR 20100110) and it compiled
> successfully for -O[0123s].
> 
> <snip> 
> > This was compiled using a cross-compiler on an x86_64 system as outlined below:
> 
> Could you try using a 32-bit host?

Sorry about being vague on the previous GCC versions--I didn't think it
mattered that much. I very well could have been using patches from Atmel back
then (it was a while ago). I cannot reproduce the problem today on vanilla GCC
4.3.5 and 4.4.6.

However I am able to reproduce the problem on 4.5.3 right now too (on a 64-bit
host).


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

* [Bug target/49487] Internal compiler error in AVR code
  2011-06-21 14:38 [Bug c/49487] New: Internal compiler error in AVR code gandalf at winds dot org
                   ` (3 preceding siblings ...)
  2011-06-21 17:18 ` gandalf at winds dot org
@ 2011-06-24 20:12 ` gjl at gcc dot gnu.org
  2011-07-13 12:15 ` [Bug target/49487] Internal compiler error in AVR code (bytewise rotate) gjl at gcc dot gnu.org
                   ` (4 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: gjl at gcc dot gnu.org @ 2011-06-24 20:12 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49487

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |ice-on-valid-code
                 CC|                            |gjl at gcc dot gnu.org

--- Comment #4 from Georg-Johann Lay <gjl at gcc dot gnu.org> 2011-06-24 20:11:20 UTC ---
I see this on 4.5.2

In 185r.asmcons we have insn 40:

(insn 40 38 41 4 foo.c:6 (parallel [
            (set (reg:HI 94)
                (rotate:HI (reg/v:HI 66 [ _x ])
                    (const_int 8 [0x8])))
            (clobber (reg:QI 95))
        ]) 64 {*rotbhi} (expr_list:REG_DEAD (reg/v:HI 66 [ _x ])
        (expr_list:REG_UNUSED (reg:QI 95)
            (nil))))

and in 188r.ira it is:

(insn 40 38 41 4 foo.c:6 (parallel [
            (set (reg:HI 20 r20 [94])
                (rotate:HI (reg/v:HI 20 r20 [orig:66 _x ] [66])
                    (const_int 8 [0x8])))
            (clobber (mem/c:QI (plus:HI (reg/f:HI 28 r28)
                        (const_int 1 [0x1])) [3 %sfp+1 S1 A8]))
        ]) 64 {*rotbhi} (nil))

At first sight I thought it is a reload bug, but it's not.
The bug goes like that:

operand3 gets constraint verbatim from rotx iterator, witch reads for HI
  (HI "X,X,X")
That was correct if reload would supply a scratch.  However, these rot patterns
don't request a scratch, the respective expander already supplies a pseudo.

So the "X" does not mean "don't need a scratch", instead it means "everything
is fine" so that reload need not generate reload insns to force "r" or whatever
constraint.

So either the constrint must be "=&r" or so if a pseudo is pre-generated (this
is waste because the reg is not needed and can even force a frame/frame
pointer) or this has to be rewritten as a proper scratch.


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

* [Bug target/49487] Internal compiler error in AVR code (bytewise rotate)
  2011-06-21 14:38 [Bug c/49487] New: Internal compiler error in AVR code gandalf at winds dot org
                   ` (4 preceding siblings ...)
  2011-06-24 20:12 ` gjl at gcc dot gnu.org
@ 2011-07-13 12:15 ` gjl at gcc dot gnu.org
  2011-07-14 15:11 ` gjl at gcc dot gnu.org
                   ` (3 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: gjl at gcc dot gnu.org @ 2011-07-13 12:15 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49487

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|---                         |4.6.2


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

* [Bug target/49487] Internal compiler error in AVR code (bytewise rotate)
  2011-06-21 14:38 [Bug c/49487] New: Internal compiler error in AVR code gandalf at winds dot org
                   ` (5 preceding siblings ...)
  2011-07-13 12:15 ` [Bug target/49487] Internal compiler error in AVR code (bytewise rotate) gjl at gcc dot gnu.org
@ 2011-07-14 15:11 ` gjl at gcc dot gnu.org
  2011-07-14 15:18 ` gjl at gcc dot gnu.org
                   ` (2 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: gjl at gcc dot gnu.org @ 2011-07-14 15:11 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49487

--- Comment #5 from Georg-Johann Lay <gjl at gcc dot gnu.org> 2011-07-14 15:10:17 UTC ---
Author: gjl
Date: Thu Jul 14 15:10:12 2011
New Revision: 176276

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=176276
Log:

    PR target/49487
    * config/avr/avr.md (rotl<mode>3): Generate SCRATCH instead
    of REG.
    (*rotw<mode>): Use const_int_operand for operand2.
    Use match_scatch for operand3.
    (*rotb<mode>): Ditto
    * config/avr/avr.c (avr_rotate_bytes): Treat SCRATCH.


Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/config/avr/avr.c
    trunk/gcc/config/avr/avr.md


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

* [Bug target/49487] Internal compiler error in AVR code (bytewise rotate)
  2011-06-21 14:38 [Bug c/49487] New: Internal compiler error in AVR code gandalf at winds dot org
                   ` (7 preceding siblings ...)
  2011-07-14 15:18 ` gjl at gcc dot gnu.org
@ 2011-07-14 15:18 ` gjl at gcc dot gnu.org
  2011-07-25  8:43 ` gjl at gcc dot gnu.org
  9 siblings, 0 replies; 11+ messages in thread
From: gjl at gcc dot gnu.org @ 2011-07-14 15:18 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49487

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |FIXED

--- Comment #7 from Georg-Johann Lay <gjl at gcc dot gnu.org> 2011-07-14 15:18:04 UTC ---
Closed as FIXED for the Milestone.


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

* [Bug target/49487] Internal compiler error in AVR code (bytewise rotate)
  2011-06-21 14:38 [Bug c/49487] New: Internal compiler error in AVR code gandalf at winds dot org
                   ` (6 preceding siblings ...)
  2011-07-14 15:11 ` gjl at gcc dot gnu.org
@ 2011-07-14 15:18 ` gjl at gcc dot gnu.org
  2011-07-14 15:18 ` gjl at gcc dot gnu.org
  2011-07-25  8:43 ` gjl at gcc dot gnu.org
  9 siblings, 0 replies; 11+ messages in thread
From: gjl at gcc dot gnu.org @ 2011-07-14 15:18 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49487

--- Comment #6 from Georg-Johann Lay <gjl at gcc dot gnu.org> 2011-07-14 15:15:31 UTC ---
Author: gjl
Date: Thu Jul 14 15:15:28 2011
New Revision: 176277

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=176277
Log:

    PR target/49487
    Backport from mainline r176276
    2011-07-14  Georg-Johann Lay
    * config/avr/avr.md (rotl<mode>3): Generate SCRATCH instead
    of REG.
    (*rotw<mode>): Use const_int_operand for operand2.
    Use match_scatch for operand3.
    (*rotb<mode>): Ditto
    * config/avr/avr.c (avr_rotate_bytes): Treat SCRATCH.


Modified:
    branches/gcc-4_6-branch/gcc/ChangeLog
    branches/gcc-4_6-branch/gcc/config/avr/avr.c
    branches/gcc-4_6-branch/gcc/config/avr/avr.md


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

* [Bug target/49487] Internal compiler error in AVR code (bytewise rotate)
  2011-06-21 14:38 [Bug c/49487] New: Internal compiler error in AVR code gandalf at winds dot org
                   ` (8 preceding siblings ...)
  2011-07-14 15:18 ` gjl at gcc dot gnu.org
@ 2011-07-25  8:43 ` gjl at gcc dot gnu.org
  9 siblings, 0 replies; 11+ messages in thread
From: gjl at gcc dot gnu.org @ 2011-07-25  8:43 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49487

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |jh.gcc-bugzilla at plonk
                   |                            |dot de

--- Comment #8 from Georg-Johann Lay <gjl at gcc dot gnu.org> 2011-07-25 08:43:04 UTC ---
*** Bug 47509 has been marked as a duplicate of this bug. ***


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

end of thread, other threads:[~2011-07-25  8:43 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-06-21 14:38 [Bug c/49487] New: Internal compiler error in AVR code gandalf at winds dot org
2011-06-21 15:28 ` [Bug target/49487] " eric.weddington at atmel dot com
2011-06-21 15:58 ` j at uriah dot heep.sax.de
2011-06-21 16:15 ` eric.weddington at atmel dot com
2011-06-21 17:18 ` gandalf at winds dot org
2011-06-24 20:12 ` gjl at gcc dot gnu.org
2011-07-13 12:15 ` [Bug target/49487] Internal compiler error in AVR code (bytewise rotate) gjl at gcc dot gnu.org
2011-07-14 15:11 ` gjl at gcc dot gnu.org
2011-07-14 15:18 ` gjl at gcc dot gnu.org
2011-07-14 15:18 ` gjl at gcc dot gnu.org
2011-07-25  8:43 ` gjl 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).