public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/20076] New: __builtin_return(__builtin_apply()) inlined incorrectly
@ 2005-02-19 19:40 gcczilla at achurch dot org
  2005-02-19 19:42 ` [Bug c/20076] " gcczilla at achurch dot org
                   ` (8 more replies)
  0 siblings, 9 replies; 10+ messages in thread
From: gcczilla at achurch dot org @ 2005-02-19 19:40 UTC (permalink / raw)
  To: gcc-bugs

GCC 3.4.3 (i686-pc-linux-gnu) generates incorrect code when a function
containing __builtin_return(__builtin_apply(...)) is inlined, whether by the
"inline" keyword or with -finline-functions.  For example, take this simple program:

int bar(int hoge) { return hoge; }
int foo(int xyzzy) {
__builtin_return(__builtin_apply(bar,__builtin_apply_args(),64)); }
int main(int ac, char **av) { return foo(9)==9 && foo(42)==42 ? 0 : 1; }

This should generate a main() with two calls to foo(), but with
-finline-functions, main() instead consists of a __builtin_apply() call to bar()
directly, using the arguments to main() rather than the argument passed to
foo().  See attached assembly listings.

$ gcc -vReading specs from /pkg/gcc/lib/gcc/i686-pc-linux-gnu/3.4.3/specs
Configured with: /tmp/packager17310.149/gcc-3.4.3/configure --prefix=/pkg/gcc
--enable-languages=c,c++ --disable-shared --disable-nls
Thread model: posix
gcc version 3.4.3

-- 
           Summary: __builtin_return(__builtin_apply()) inlined incorrectly
           Product: gcc
           Version: 3.4.3
            Status: UNCONFIRMED
          Severity: critical
          Priority: P2
         Component: c
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: gcczilla at achurch dot org
                CC: gcc-bugs at gcc dot gnu dot org
 GCC build triplet: i686-pc-linux-gnu
  GCC host triplet: i686-pc-linux-gnu
GCC target triplet: i686-pc-linux-gnu


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


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

* [Bug c/20076] __builtin_return(__builtin_apply()) inlined incorrectly
  2005-02-19 19:40 [Bug c/20076] New: __builtin_return(__builtin_apply()) inlined incorrectly gcczilla at achurch dot org
@ 2005-02-19 19:42 ` gcczilla at achurch dot org
  2005-02-19 19:44 ` gcczilla at achurch dot org
                   ` (7 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: gcczilla at achurch dot org @ 2005-02-19 19:42 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From gcczilla at achurch dot org  2005-02-19 12:57 -------
Created an attachment (id=8231)
 --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=8231&action=view)
Test source file (from description)


-- 


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


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

* [Bug c/20076] __builtin_return(__builtin_apply()) inlined incorrectly
  2005-02-19 19:40 [Bug c/20076] New: __builtin_return(__builtin_apply()) inlined incorrectly gcczilla at achurch dot org
  2005-02-19 19:42 ` [Bug c/20076] " gcczilla at achurch dot org
@ 2005-02-19 19:44 ` gcczilla at achurch dot org
  2005-02-19 19:56 ` gcczilla at achurch dot org
                   ` (6 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: gcczilla at achurch dot org @ 2005-02-19 19:44 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From gcczilla at achurch dot org  2005-02-19 12:58 -------
Created an attachment (id=8232)
 --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=8232&action=view)
gcc test.c -S -O2


-- 


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


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

* [Bug c/20076] __builtin_return(__builtin_apply()) inlined incorrectly
  2005-02-19 19:40 [Bug c/20076] New: __builtin_return(__builtin_apply()) inlined incorrectly gcczilla at achurch dot org
  2005-02-19 19:42 ` [Bug c/20076] " gcczilla at achurch dot org
  2005-02-19 19:44 ` gcczilla at achurch dot org
@ 2005-02-19 19:56 ` gcczilla at achurch dot org
  2005-02-19 20:11 ` [Bug tree-optimization/20076] [3.3/3.4/4.0 Regression] " pinskia at gcc dot gnu dot org
                   ` (5 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: gcczilla at achurch dot org @ 2005-02-19 19:56 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From gcczilla at achurch dot org  2005-02-19 12:59 -------
Created an attachment (id=8233)
 --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=8233&action=view)
gcc test.c -S -O2 -finline-functions (bad)


-- 


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


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

* [Bug tree-optimization/20076] [3.3/3.4/4.0 Regression] __builtin_return(__builtin_apply()) inlined incorrectly
  2005-02-19 19:40 [Bug c/20076] New: __builtin_return(__builtin_apply()) inlined incorrectly gcczilla at achurch dot org
                   ` (2 preceding siblings ...)
  2005-02-19 19:56 ` gcczilla at achurch dot org
@ 2005-02-19 20:11 ` pinskia at gcc dot gnu dot org
  2005-04-05 11:19 ` [Bug tree-optimization/20076] [3.3/3.4/4.0/4.1 " jakub at gcc dot gnu dot org
                   ` (4 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-02-19 20:11 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2005-02-19 13:22 -------
Confirmed.

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
           Severity|critical                    |normal
             Status|UNCONFIRMED                 |NEW
          Component|c                           |tree-optimization
     Ever Confirmed|                            |1
           Keywords|                            |wrong-code
      Known to fail|                            |3.3.3 3.4.0 4.0.0
      Known to work|                            |3.0.4 2.95.3
   Last reconfirmed|0000-00-00 00:00:00         |2005-02-19 13:22:27
               date|                            |
            Summary|__builtin_return(__builtin_a|[3.3/3.4/4.0 Regression]
                   |pply()) inlined incorrectly |__builtin_return(__builtin_a
                   |                            |pply()) inlined incorrectly
   Target Milestone|---                         |3.4.4


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


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

* [Bug tree-optimization/20076] [3.3/3.4/4.0/4.1 Regression] __builtin_return(__builtin_apply()) inlined incorrectly
  2005-02-19 19:40 [Bug c/20076] New: __builtin_return(__builtin_apply()) inlined incorrectly gcczilla at achurch dot org
                   ` (3 preceding siblings ...)
  2005-02-19 20:11 ` [Bug tree-optimization/20076] [3.3/3.4/4.0 Regression] " pinskia at gcc dot gnu dot org
@ 2005-04-05 11:19 ` jakub at gcc dot gnu dot org
  2005-04-05 20:10 ` cvs-commit at gcc dot gnu dot org
                   ` (3 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: jakub at gcc dot gnu dot org @ 2005-04-05 11:19 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From jakub at gcc dot gnu dot org  2005-04-05 11:19 -------
Patch here: <http://gcc.gnu.org/ml/gcc-patches/2005-04/msg00497.html>

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |patch


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


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

* [Bug tree-optimization/20076] [3.3/3.4/4.0/4.1 Regression] __builtin_return(__builtin_apply()) inlined incorrectly
  2005-02-19 19:40 [Bug c/20076] New: __builtin_return(__builtin_apply()) inlined incorrectly gcczilla at achurch dot org
                   ` (4 preceding siblings ...)
  2005-04-05 11:19 ` [Bug tree-optimization/20076] [3.3/3.4/4.0/4.1 " jakub at gcc dot gnu dot org
@ 2005-04-05 20:10 ` cvs-commit at gcc dot gnu dot org
  2005-04-06  5:58 ` [Bug tree-optimization/20076] [3.3/3.4/4.0 " cvs-commit at gcc dot gnu dot org
                   ` (2 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: cvs-commit at gcc dot gnu dot org @ 2005-04-05 20:10 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From cvs-commit at gcc dot gnu dot org  2005-04-05 20:10 -------
Subject: Bug 20076

CVSROOT:	/cvs/gcc
Module name:	gcc
Changes by:	jakub@gcc.gnu.org	2005-04-05 20:10:14

Modified files:
	gcc            : ChangeLog tree-inline.c 
	gcc/testsuite  : ChangeLog 
Added files:
	gcc/testsuite/gcc.dg: builtin-apply4.c 

Log message:
	PR tree-optimization/20076
	* tree-inline.c (inline_forbidden_p_1): Prevent inlining functions
	that call __builtin_return or __builtin_apply_args.
	
	* gcc.dg/builtin-apply4.c: New test.

Patches:
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/ChangeLog.diff?cvsroot=gcc&r1=2.8149&r2=2.8150
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/tree-inline.c.diff?cvsroot=gcc&r1=1.178&r2=1.179
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/ChangeLog.diff?cvsroot=gcc&r1=1.5288&r2=1.5289
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/gcc.dg/builtin-apply4.c.diff?cvsroot=gcc&r1=NONE&r2=1.1



-- 


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


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

* [Bug tree-optimization/20076] [3.3/3.4/4.0 Regression] __builtin_return(__builtin_apply()) inlined incorrectly
  2005-02-19 19:40 [Bug c/20076] New: __builtin_return(__builtin_apply()) inlined incorrectly gcczilla at achurch dot org
                   ` (5 preceding siblings ...)
  2005-04-05 20:10 ` cvs-commit at gcc dot gnu dot org
@ 2005-04-06  5:58 ` cvs-commit at gcc dot gnu dot org
  2005-04-06 14:19 ` [Bug tree-optimization/20076] [3.3/3.4 " jsm28 at gcc dot gnu dot org
  2005-05-19 17:33 ` mmitchel at gcc dot gnu dot org
  8 siblings, 0 replies; 10+ messages in thread
From: cvs-commit at gcc dot gnu dot org @ 2005-04-06  5:58 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From cvs-commit at gcc dot gnu dot org  2005-04-06 05:57 -------
Subject: Bug 20076

CVSROOT:	/cvs/gcc
Module name:	gcc
Branch: 	gcc-4_0-branch
Changes by:	jakub@gcc.gnu.org	2005-04-06 05:57:39

Modified files:
	gcc            : ChangeLog tree-inline.c 
	gcc/testsuite  : ChangeLog 
Added files:
	gcc/testsuite/gcc.dg: builtin-apply4.c 

Log message:
	PR tree-optimization/20076
	* tree-inline.c (inline_forbidden_p_1): Prevent inlining functions
	that call __builtin_return or __builtin_apply_args.
	
	* gcc.dg/builtin-apply4.c: New test.

Patches:
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/ChangeLog.diff?cvsroot=gcc&only_with_tag=gcc-4_0-branch&r1=2.7592.2.137&r2=2.7592.2.138
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/tree-inline.c.diff?cvsroot=gcc&only_with_tag=gcc-4_0-branch&r1=1.170.8.2&r2=1.170.8.3
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/ChangeLog.diff?cvsroot=gcc&only_with_tag=gcc-4_0-branch&r1=1.5084.2.108&r2=1.5084.2.109
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/gcc.dg/builtin-apply4.c.diff?cvsroot=gcc&only_with_tag=gcc-4_0-branch&r1=NONE&r2=1.1.2.1



-- 


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


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

* [Bug tree-optimization/20076] [3.3/3.4 Regression] __builtin_return(__builtin_apply()) inlined incorrectly
  2005-02-19 19:40 [Bug c/20076] New: __builtin_return(__builtin_apply()) inlined incorrectly gcczilla at achurch dot org
                   ` (6 preceding siblings ...)
  2005-04-06  5:58 ` [Bug tree-optimization/20076] [3.3/3.4/4.0 " cvs-commit at gcc dot gnu dot org
@ 2005-04-06 14:19 ` jsm28 at gcc dot gnu dot org
  2005-05-19 17:33 ` mmitchel at gcc dot gnu dot org
  8 siblings, 0 replies; 10+ messages in thread
From: jsm28 at gcc dot gnu dot org @ 2005-04-06 14:19 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From jsm28 at gcc dot gnu dot org  2005-04-06 14:18 -------
gcc.dg/builtin-apply4.c execution test is failing on mainline on ia64-hpux. 
gcc-testresults also shows it failing on 4.0 branch on ia64-linux.

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |jakub at gcc dot gnu dot
                   |                            |org, jsm28 at gcc dot gnu
                   |                            |dot org


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


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

* [Bug tree-optimization/20076] [3.3/3.4 Regression] __builtin_return(__builtin_apply()) inlined incorrectly
  2005-02-19 19:40 [Bug c/20076] New: __builtin_return(__builtin_apply()) inlined incorrectly gcczilla at achurch dot org
                   ` (7 preceding siblings ...)
  2005-04-06 14:19 ` [Bug tree-optimization/20076] [3.3/3.4 " jsm28 at gcc dot gnu dot org
@ 2005-05-19 17:33 ` mmitchel at gcc dot gnu dot org
  8 siblings, 0 replies; 10+ messages in thread
From: mmitchel at gcc dot gnu dot org @ 2005-05-19 17:33 UTC (permalink / raw)
  To: gcc-bugs



-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|3.4.4                       |3.4.5


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


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

end of thread, other threads:[~2005-05-19 17:33 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-02-19 19:40 [Bug c/20076] New: __builtin_return(__builtin_apply()) inlined incorrectly gcczilla at achurch dot org
2005-02-19 19:42 ` [Bug c/20076] " gcczilla at achurch dot org
2005-02-19 19:44 ` gcczilla at achurch dot org
2005-02-19 19:56 ` gcczilla at achurch dot org
2005-02-19 20:11 ` [Bug tree-optimization/20076] [3.3/3.4/4.0 Regression] " pinskia at gcc dot gnu dot org
2005-04-05 11:19 ` [Bug tree-optimization/20076] [3.3/3.4/4.0/4.1 " jakub at gcc dot gnu dot org
2005-04-05 20:10 ` cvs-commit at gcc dot gnu dot org
2005-04-06  5:58 ` [Bug tree-optimization/20076] [3.3/3.4/4.0 " cvs-commit at gcc dot gnu dot org
2005-04-06 14:19 ` [Bug tree-optimization/20076] [3.3/3.4 " jsm28 at gcc dot gnu dot org
2005-05-19 17:33 ` mmitchel 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).