public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/30637]  New: The options -fno-unit-at-a-time and -finline-functions generates erroneous code
@ 2007-01-30 10:22 steby at enea dot se
  2007-01-30 10:28 ` [Bug c++/30637] " steby at enea dot se
                   ` (6 more replies)
  0 siblings, 7 replies; 8+ messages in thread
From: steby at enea dot se @ 2007-01-30 10:22 UTC (permalink / raw)
  To: gcc-bugs

When compiling the attached source code snippet test.cpp with the options
-fno-unit-at-a-time and -finline-functions, erroneous code is produced in form
of an infinite loop, see the attached disassembly file test.s.

Use the following command line to reproduce the bug:
powerpc-eabi-g++ -c -S -O2 -fno-unit-at-a-time -finline-functions -o test.s
test.cpp

A possible explanation for this bug may be that -fno-unit-at-a-time counteracts
-finline-functions; -finline-functions needs the whole compilation unit or more
while -finline-functions says don't use the whole compilation unit.


-- 
           Summary: The options -fno-unit-at-a-time and -finline-functions
                    generates erroneous code
           Product: gcc
           Version: 3.4.4
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: steby at enea dot se
 GCC build triplet: i386-linux-gnu
  GCC host triplet: i386-linux-gnu
GCC target triplet: powerpc-eabi-unknown


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


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

* [Bug c++/30637] The options -fno-unit-at-a-time and -finline-functions generates erroneous code
  2007-01-30 10:22 [Bug c++/30637] New: The options -fno-unit-at-a-time and -finline-functions generates erroneous code steby at enea dot se
@ 2007-01-30 10:28 ` steby at enea dot se
  2007-01-30 10:29 ` steby at enea dot se
                   ` (5 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: steby at enea dot se @ 2007-01-30 10:28 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from steby at enea dot se  2007-01-30 10:28 -------
Created an attachment (id=12979)
 --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=12979&action=view)
Source code snippet


-- 


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


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

* [Bug c++/30637] The options -fno-unit-at-a-time and -finline-functions generates erroneous code
  2007-01-30 10:22 [Bug c++/30637] New: The options -fno-unit-at-a-time and -finline-functions generates erroneous code steby at enea dot se
  2007-01-30 10:28 ` [Bug c++/30637] " steby at enea dot se
@ 2007-01-30 10:29 ` steby at enea dot se
  2007-01-30 10:33 ` pinskia at gcc dot gnu dot org
                   ` (4 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: steby at enea dot se @ 2007-01-30 10:29 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #2 from steby at enea dot se  2007-01-30 10:29 -------
Created an attachment (id=12980)
 --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=12980&action=view)
Disassembly output


-- 


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


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

* [Bug c++/30637] The options -fno-unit-at-a-time and -finline-functions generates erroneous code
  2007-01-30 10:22 [Bug c++/30637] New: The options -fno-unit-at-a-time and -finline-functions generates erroneous code steby at enea dot se
  2007-01-30 10:28 ` [Bug c++/30637] " steby at enea dot se
  2007-01-30 10:29 ` steby at enea dot se
@ 2007-01-30 10:33 ` pinskia at gcc dot gnu dot org
  2007-01-30 10:40 ` steby at enea dot se
                   ` (3 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2007-01-30 10:33 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #3 from pinskia at gcc dot gnu dot org  2007-01-30 10:33 -------
Can you try 4.0.x or 4.1.x as 3.4.x is no longer maintained?


-- 


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


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

* [Bug c++/30637] The options -fno-unit-at-a-time and -finline-functions generates erroneous code
  2007-01-30 10:22 [Bug c++/30637] New: The options -fno-unit-at-a-time and -finline-functions generates erroneous code steby at enea dot se
                   ` (2 preceding siblings ...)
  2007-01-30 10:33 ` pinskia at gcc dot gnu dot org
@ 2007-01-30 10:40 ` steby at enea dot se
  2007-01-30 10:43 ` steby at enea dot se
                   ` (2 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: steby at enea dot se @ 2007-01-30 10:40 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #4 from steby at enea dot se  2007-01-30 10:40 -------
(In reply to comment #3)
> Can you try 4.0.x or 4.1.x as 3.4.x is no longer maintained?

Unfortunately, our system is based on GCC 3.4.x and we cannot easily switch to
GCC 4.x in a short timeframe.


-- 


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


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

* [Bug c++/30637] The options -fno-unit-at-a-time and -finline-functions generates erroneous code
  2007-01-30 10:22 [Bug c++/30637] New: The options -fno-unit-at-a-time and -finline-functions generates erroneous code steby at enea dot se
                   ` (3 preceding siblings ...)
  2007-01-30 10:40 ` steby at enea dot se
@ 2007-01-30 10:43 ` steby at enea dot se
  2007-02-09  1:17 ` reichelt at gcc dot gnu dot org
  2007-02-09 22:09 ` reichelt at gcc dot gnu dot org
  6 siblings, 0 replies; 8+ messages in thread
From: steby at enea dot se @ 2007-01-30 10:43 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #5 from steby at enea dot se  2007-01-30 10:43 -------
(From update of attachment 12980)
>	.file	"test.cpp"
>	.section	".text"
>	.align 2
>	.globl _ZN5Actor17getResourceFacadeEv
>	.type	_ZN5Actor17getResourceFacadeEv, @function
>_ZN5Actor17getResourceFacadeEv:
>.LFB2:
>	lwz 3,0(3)
>	blr
>.LFE2:
>	.size	_ZN5Actor17getResourceFacadeEv, .-_ZN5Actor17getResourceFacadeEv
>	.align 2
>	.globl _ZN5Actor9configureEv
>	.type	_ZN5Actor9configureEv, @function
>_ZN5Actor9configureEv:
>.LFB3:
>.L3:
>	b .L3 <--------------------- ERROR: Infinite loop!
>.LFE3:
>	.size	_ZN5Actor9configureEv, .-_ZN5Actor9configureEv
>	.ident	"GCC: (GNU) 3.4.4"


-- 


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


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

* [Bug c++/30637] The options -fno-unit-at-a-time and -finline-functions generates erroneous code
  2007-01-30 10:22 [Bug c++/30637] New: The options -fno-unit-at-a-time and -finline-functions generates erroneous code steby at enea dot se
                   ` (4 preceding siblings ...)
  2007-01-30 10:43 ` steby at enea dot se
@ 2007-02-09  1:17 ` reichelt at gcc dot gnu dot org
  2007-02-09 22:09 ` reichelt at gcc dot gnu dot org
  6 siblings, 0 replies; 8+ messages in thread
From: reichelt at gcc dot gnu dot org @ 2007-02-09  1:17 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #6 from reichelt at gcc dot gnu dot org  2007-02-09 01:16 -------
The bug has nothing to do with -fno-unit-at-a-time.
(It is ignored for C++ anyways.)

The bug is fixed since GCC 4.0.0.

Btw, here's a shorter self-contained program that hangs when compiled with
"g++ -O -finline-functions" by GCC 3.4.x:

====================================
struct A
{
   virtual void FOO() {}
};

struct B
{
  A* p;

  B() : p(new A) {}

  A* foo();
  void bar();
};

A* B::foo()
{
  return p;
}

void B::bar()
{
  foo()->FOO();
}

int main()
{
  B().bar();
  return 0;
}
====================================


-- 

reichelt at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |reichelt at gcc dot gnu dot
                   |                            |org
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|                            |FIXED
   Target Milestone|---                         |4.0.0


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


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

* [Bug c++/30637] The options -fno-unit-at-a-time and -finline-functions generates erroneous code
  2007-01-30 10:22 [Bug c++/30637] New: The options -fno-unit-at-a-time and -finline-functions generates erroneous code steby at enea dot se
                   ` (5 preceding siblings ...)
  2007-02-09  1:17 ` reichelt at gcc dot gnu dot org
@ 2007-02-09 22:09 ` reichelt at gcc dot gnu dot org
  6 siblings, 0 replies; 8+ messages in thread
From: reichelt at gcc dot gnu dot org @ 2007-02-09 22:09 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #7 from reichelt at gcc dot gnu dot org  2007-02-09 22:09 -------
Sorry, I wasn't quite right with my comment:
The bug *is* related to -fno-unit-at-a-time.
It is fixed, because the flag is ignored for C++ since GCC 4.0.0,
i.e. the compiler now always uses the unit-at-a-time mode for C++.


-- 


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


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

end of thread, other threads:[~2007-02-09 22:09 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-01-30 10:22 [Bug c++/30637] New: The options -fno-unit-at-a-time and -finline-functions generates erroneous code steby at enea dot se
2007-01-30 10:28 ` [Bug c++/30637] " steby at enea dot se
2007-01-30 10:29 ` steby at enea dot se
2007-01-30 10:33 ` pinskia at gcc dot gnu dot org
2007-01-30 10:40 ` steby at enea dot se
2007-01-30 10:43 ` steby at enea dot se
2007-02-09  1:17 ` reichelt at gcc dot gnu dot org
2007-02-09 22:09 ` reichelt 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).