public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/12503] New: __builtin_apply_args fails on sparc-sun-solaris2.9
@ 2003-10-03 19:22 pierre dot nguyen-tuong at asim dot lip6 dot fr
2003-10-03 19:26 ` [Bug c++/12503] " pierre dot nguyen-tuong at asim dot lip6 dot fr
` (4 more replies)
0 siblings, 5 replies; 6+ messages in thread
From: pierre dot nguyen-tuong at asim dot lip6 dot fr @ 2003-10-03 19:22 UTC (permalink / raw)
To: gcc-bugs
PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=12503
Summary: __builtin_apply_args fails on sparc-sun-solaris2.9
Product: gcc
Version: 3.3.1
Status: UNCONFIRMED
Severity: critical
Priority: P2
Component: c++
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: pierre dot nguyen-tuong at asim dot lip6 dot fr
CC: gcc-bugs at gcc dot gnu dot org
__builtin_apply_args do not put all arguments on the stack
Example (source code below):
- funcA is a variadic function
- funcB is a normal function
- funcA is called and should give all its arguments to funcB thanks to
__builtin_apply_args and __builtin_apply
main -> funcA(args) -> funcB(args)
Works fine on Linux, g++ 3.3.1, but fails on Solaris 2.9 gcc 3.3.1
Compile file demo.cpp with g++ -Wall -o demo demo.cpp and run :
-------------------------------------------------------------------
#include <iostream>
#include <stdlib.h>
#include <stdarg.h>
#include <stdlib.h>
using namespace std ;
// Arguments : char *
// double
// double
// double
// int
// int
extern "C" void funcB(char *name,double d,double e,double f,int g,int h)
{
cout << "----------------------- funcB --------------------------------\n" ;
cout << "---- arg #0 (name) : " << &name << " " << name << endl ;
cout << "---- arg #1 (double) : " << &d << " " << d << endl ;
cout << "---- arg #2 (double) : " << &e << " " << e << endl ;
cout << "---- arg #3 (double) : " << &f << " " << f << endl ;
cout << "---- arg #4 (int) : " << &g << " " << g << endl ;
cout << "---- arg #5 (int) : " << &h << " " << h << endl ;
cout << "----------------------- End of funcB -------------------------\n" ;
}
extern "C" void funcA(char *name,...)
{
int size = 0 ;
void *arguments = NULL ;
va_list ap = NULL ;
int i = 0 ;
double d = 0.0 ;
va_start(ap,name) ;
cout << "----------------------- funcA --------------------------------\n" ;
cout << "---- arg #0 (name) : " << ap << " " << name << endl ;
d = va_arg(ap,double) ;
cout << "---- arg #1 (double) : " << ap << " " << d << endl ;
d = va_arg(ap,double) ;
cout << "---- arg #2 (double) : " << ap << " " << d << endl ;
d = va_arg(ap,double) ;
cout << "---- arg #3 (double) : " << ap << " " << d << endl ;
i = va_arg(ap,int) ;
cout << "---- arg #4 (int) : " << ap << " " << i << endl ;
i = va_arg(ap,int) ;
cout << "---- arg #5 (int) : " << ap << " " << i << endl ;
va_end(ap) ;
size = sizeof(char *) + 3 * sizeof(double) + 2 * sizeof(int) ;
cout << "---- Size = " << size << endl ;
arguments = __builtin_apply_args(size) ;
cout << "---- Arg pointer = " << arguments << endl ;
cout << "---- Calling function\n" ;
__builtin_apply((void (*)(...))funcB,arguments,size) ;
cout << "----------------------- End of funcA --------------------\n" ;
}
int main()
{
funcA("eeee",5.444567,8.90765,4.567789,5,9076) ;
return 0 ;
}
-------------------------------------------------------------------
Arguments 5 and 6 are missing in funcB.
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug c++/12503] __builtin_apply_args fails on sparc-sun-solaris2.9
2003-10-03 19:22 [Bug c++/12503] New: __builtin_apply_args fails on sparc-sun-solaris2.9 pierre dot nguyen-tuong at asim dot lip6 dot fr
@ 2003-10-03 19:26 ` pierre dot nguyen-tuong at asim dot lip6 dot fr
2003-10-04 6:54 ` [Bug c++/12503] __builtin_apply_args fails ebotcazou at gcc dot gnu dot org
` (3 subsequent siblings)
4 siblings, 0 replies; 6+ messages in thread
From: pierre dot nguyen-tuong at asim dot lip6 dot fr @ 2003-10-03 19:26 UTC (permalink / raw)
To: gcc-bugs
PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=12503
------- Additional Comments From pierre dot nguyen-tuong at asim dot lip6 dot fr 2003-10-03 19:26 -------
Created an attachment (id=4887)
--> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=4887&action=view)
Demo source code for __builtin_apply_args bug
Compile with g++ -Wall -o demo demo.cpp, then run ./demo.
Args 5 and 6 of funcB are incorrect.
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug c++/12503] __builtin_apply_args fails
2003-10-03 19:22 [Bug c++/12503] New: __builtin_apply_args fails on sparc-sun-solaris2.9 pierre dot nguyen-tuong at asim dot lip6 dot fr
2003-10-03 19:26 ` [Bug c++/12503] " pierre dot nguyen-tuong at asim dot lip6 dot fr
@ 2003-10-04 6:54 ` ebotcazou at gcc dot gnu dot org
2003-10-04 7:07 ` ebotcazou at gcc dot gnu dot org
` (2 subsequent siblings)
4 siblings, 0 replies; 6+ messages in thread
From: ebotcazou at gcc dot gnu dot org @ 2003-10-04 6:54 UTC (permalink / raw)
To: gcc-bugs
PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=12503
ebotcazou at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
GCC build triplet| |sparc-sun-solaris2.9
GCC host triplet| |sparc-sun-solaris2.9
GCC target triplet| |sparc-sun-solaris2.9
Summary|__builtin_apply_args fails |__builtin_apply_args fails
|on sparc-sun-solaris2.9 |
------- Additional Comments From ebotcazou at gcc dot gnu dot org 2003-10-04 06:54 -------
Note that __builtin_apply_args take no arguments:
- Built-in Function: void * __builtin_apply_args ()
This built-in function returns a pointer to data describing how to
perform a call with the same arguments as were passed to the
current function.
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug c++/12503] __builtin_apply_args fails
2003-10-03 19:22 [Bug c++/12503] New: __builtin_apply_args fails on sparc-sun-solaris2.9 pierre dot nguyen-tuong at asim dot lip6 dot fr
2003-10-03 19:26 ` [Bug c++/12503] " pierre dot nguyen-tuong at asim dot lip6 dot fr
2003-10-04 6:54 ` [Bug c++/12503] __builtin_apply_args fails ebotcazou at gcc dot gnu dot org
@ 2003-10-04 7:07 ` ebotcazou at gcc dot gnu dot org
2003-10-04 14:16 ` ebotcazou at gcc dot gnu dot org
2003-11-27 6:25 ` [Bug middle-end/12503] " ebotcazou at gcc dot gnu dot org
4 siblings, 0 replies; 6+ messages in thread
From: ebotcazou at gcc dot gnu dot org @ 2003-10-04 7:07 UTC (permalink / raw)
To: gcc-bugs
PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=12503
ebotcazou at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
Severity|critical |normal
Status|UNCONFIRMED |NEW
Ever Confirmed| |1
Last reconfirmed|0000-00-00 00:00:00 |2003-10-04 07:07:33
date| |
Target Milestone|--- |3.4
------- Additional Comments From ebotcazou at gcc dot gnu dot org 2003-10-04 07:07 -------
Confirmed with all versions I tested (2.95.3, 3.2.x, 3.3.x, 3.3.2pre, 3.4exp).
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug c++/12503] __builtin_apply_args fails
2003-10-03 19:22 [Bug c++/12503] New: __builtin_apply_args fails on sparc-sun-solaris2.9 pierre dot nguyen-tuong at asim dot lip6 dot fr
` (2 preceding siblings ...)
2003-10-04 7:07 ` ebotcazou at gcc dot gnu dot org
@ 2003-10-04 14:16 ` ebotcazou at gcc dot gnu dot org
2003-11-27 6:25 ` [Bug middle-end/12503] " ebotcazou at gcc dot gnu dot org
4 siblings, 0 replies; 6+ messages in thread
From: ebotcazou at gcc dot gnu dot org @ 2003-10-04 14:16 UTC (permalink / raw)
To: gcc-bugs
PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=12503
ebotcazou at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
AssignedTo|unassigned at gcc dot gnu |ebotcazou at gcc dot gnu dot
|dot org |org
Status|NEW |ASSIGNED
------- Additional Comments From ebotcazou at gcc dot gnu dot org 2003-10-04 14:16 -------
Investigating.
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug middle-end/12503] __builtin_apply_args fails
2003-10-03 19:22 [Bug c++/12503] New: __builtin_apply_args fails on sparc-sun-solaris2.9 pierre dot nguyen-tuong at asim dot lip6 dot fr
` (3 preceding siblings ...)
2003-10-04 14:16 ` ebotcazou at gcc dot gnu dot org
@ 2003-11-27 6:25 ` ebotcazou at gcc dot gnu dot org
4 siblings, 0 replies; 6+ messages in thread
From: ebotcazou at gcc dot gnu dot org @ 2003-11-27 6:25 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From ebotcazou at gcc dot gnu dot org 2003-11-27 06:25 -------
See http://gcc.gnu.org/ml/gcc-patches/2003-10/msg00897.html
--
What |Removed |Added
----------------------------------------------------------------------------
Status|ASSIGNED |RESOLVED
Resolution| |FIXED
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=12503
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2003-11-27 6:25 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-10-03 19:22 [Bug c++/12503] New: __builtin_apply_args fails on sparc-sun-solaris2.9 pierre dot nguyen-tuong at asim dot lip6 dot fr
2003-10-03 19:26 ` [Bug c++/12503] " pierre dot nguyen-tuong at asim dot lip6 dot fr
2003-10-04 6:54 ` [Bug c++/12503] __builtin_apply_args fails ebotcazou at gcc dot gnu dot org
2003-10-04 7:07 ` ebotcazou at gcc dot gnu dot org
2003-10-04 14:16 ` ebotcazou at gcc dot gnu dot org
2003-11-27 6:25 ` [Bug middle-end/12503] " ebotcazou 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).