public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug lto/42392]  New: ICE when combining LTO with asm()
@ 2009-12-16  8:36 rmh at gcc dot gnu dot org
  2009-12-16  8:38 ` [Bug lto/42392] [LTO] ICE with top level asm pinskia at gcc dot gnu dot org
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: rmh at gcc dot gnu dot org @ 2009-12-16  8:36 UTC (permalink / raw)
  To: gcc-bugs

I got this error when trying to compile GRUB (latest bzr) on amd64 with -flto:

lto1: internal compiler error: compressed stream: buffer error

The culprit was an acinclude check, which can be reduced to the following test
case:

asm (".globl start; start: nop");
int
main ()
{
}

I'm not sure this can be considered valid C (or at least valid GNU C). I'm
tentatively setting ice-on-invalid-code keyword. If I understand correctly, it
is equivalent to:

void start ()
{
  asm ("nop");
}
int
main ()
{
}

In any case I suppose if the code isn't valid, GCC ought to fail more
gracefully than this, so I report anyway in case you'd like to know :-)


-- 
           Summary: ICE when combining LTO with asm()
           Product: gcc
           Version: 4.4.1
            Status: UNCONFIRMED
          Keywords: ice-on-invalid-code, lto
          Severity: normal
          Priority: P3
         Component: lto
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: rmh at gcc dot gnu dot org


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


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

* [Bug lto/42392] [LTO] ICE with top level asm
  2009-12-16  8:36 [Bug lto/42392] New: ICE when combining LTO with asm() rmh at gcc dot gnu dot org
@ 2009-12-16  8:38 ` pinskia at gcc dot gnu dot org
  2009-12-16 13:43 ` rguenth at gcc dot gnu dot org
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2009-12-16  8:38 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from pinskia at gcc dot gnu dot org  2009-12-16 08:38 -------
top level asm is valid GNU C code.


-- 

pinskia at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|ice-on-invalid-code         |ice-on-valid-code
            Summary|ICE when combining LTO with |[LTO] ICE with top level asm
                   |asm()                       |


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


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

* [Bug lto/42392] [LTO] ICE with top level asm
  2009-12-16  8:36 [Bug lto/42392] New: ICE when combining LTO with asm() rmh at gcc dot gnu dot org
  2009-12-16  8:38 ` [Bug lto/42392] [LTO] ICE with top level asm pinskia at gcc dot gnu dot org
@ 2009-12-16 13:43 ` rguenth at gcc dot gnu dot org
  2009-12-16 23:07 ` rguenth at gcc dot gnu dot org
  2009-12-16 23:07 ` rguenth at gcc dot gnu dot org
  3 siblings, 0 replies; 5+ messages in thread
From: rguenth at gcc dot gnu dot org @ 2009-12-16 13:43 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #2 from rguenth at gcc dot gnu dot org  2009-12-16 13:43 -------
The issue here is that the asm doesn't switch sections properly and we emit
LTO sections before the actual assembly.  So we end up with

...
        .section        .gnu.lto_.opts,"",@progbits
        .string "x\001\001,"
        .string "\323\377\001"
        .string ""
...
        .ascii  "\"\306\003T"
        .section        .gnu.lto_main
#APP
        .globl start; start: nop
#NO_APP
        .text
.globl main
        .type   main, @function
main:
        pushl   %ebp
        movl    %esp, %ebp
        popl    %ebp
        ret
        .size   main, .-main
        .comm   gnu_lto_v1,1,1

where after finishing .gnu.lto_.opts we switch "back" to .gnu.lto_main which
then has the toplevel asm appended.

Oops.

Now assembling the testcase w/o LTO also gets us

        .file   "t.c"
#APP
        .globl start; start: nop
#NO_APP
        .text
.globl main
        .type   main, @function
main:
...

thus the asm gets emitted in the default section.  Which means the testcase
is kind of invalid (and the issue is that we emit LTO stuff at the beginning,
not at the end where it could remain unspecified).


-- 

rguenth at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         AssignedTo|unassigned at gcc dot gnu   |rguenth at gcc dot gnu dot
                   |dot org                     |org
             Status|UNCONFIRMED                 |ASSIGNED
     Ever Confirmed|0                           |1
   Last reconfirmed|0000-00-00 00:00:00         |2009-12-16 13:43:16
               date|                            |
            Version|4.4.1                       |4.5.0


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


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

* [Bug lto/42392] [LTO] ICE with top level asm
  2009-12-16  8:36 [Bug lto/42392] New: ICE when combining LTO with asm() rmh at gcc dot gnu dot org
                   ` (2 preceding siblings ...)
  2009-12-16 23:07 ` rguenth at gcc dot gnu dot org
@ 2009-12-16 23:07 ` rguenth at gcc dot gnu dot org
  3 siblings, 0 replies; 5+ messages in thread
From: rguenth at gcc dot gnu dot org @ 2009-12-16 23:07 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #3 from rguenth at gcc dot gnu dot org  2009-12-16 23:07 -------
Fixed.


-- 

rguenth at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
         Resolution|                            |FIXED
   Target Milestone|---                         |4.5.0


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


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

* [Bug lto/42392] [LTO] ICE with top level asm
  2009-12-16  8:36 [Bug lto/42392] New: ICE when combining LTO with asm() rmh at gcc dot gnu dot org
  2009-12-16  8:38 ` [Bug lto/42392] [LTO] ICE with top level asm pinskia at gcc dot gnu dot org
  2009-12-16 13:43 ` rguenth at gcc dot gnu dot org
@ 2009-12-16 23:07 ` rguenth at gcc dot gnu dot org
  2009-12-16 23:07 ` rguenth at gcc dot gnu dot org
  3 siblings, 0 replies; 5+ messages in thread
From: rguenth at gcc dot gnu dot org @ 2009-12-16 23:07 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #4 from rguenth at gcc dot gnu dot org  2009-12-16 23:07 -------
Subject: Bug 42392

Author: rguenth
Date: Wed Dec 16 23:07:10 2009
New Revision: 155298

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=155298
Log:
2009-12-16  Richard Guenther  <rguenther@suse.de>

        PR lto/42392
        * langhooks.c (lhd_begin_section): Make sure to switch back
        to the text section, not some random one.

        * gcc.dg/lto/20091216-1_0.c: New testcase.

Added:
    trunk/gcc/testsuite/gcc.dg/lto/20091216-1_0.c
Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/langhooks.c
    trunk/gcc/testsuite/ChangeLog


-- 


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


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

end of thread, other threads:[~2009-12-16 23:07 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-12-16  8:36 [Bug lto/42392] New: ICE when combining LTO with asm() rmh at gcc dot gnu dot org
2009-12-16  8:38 ` [Bug lto/42392] [LTO] ICE with top level asm pinskia at gcc dot gnu dot org
2009-12-16 13:43 ` rguenth at gcc dot gnu dot org
2009-12-16 23:07 ` rguenth at gcc dot gnu dot org
2009-12-16 23:07 ` rguenth at gcc dot gnu dot 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).