public inbox for gcc-prs@sourceware.org
help / color / mirror / Atom feed
* Re: optimization/6398: faulty code when inlining in a var-arged function
@ 2002-04-22  9:46 lucho
  0 siblings, 0 replies; 5+ messages in thread
From: lucho @ 2002-04-22  9:46 UTC (permalink / raw)
  To: nobody; +Cc: gcc-prs

The following reply was made to PR optimization/6398; it has been noted by GNATS.

From: lucho <lucho@haemimont.bg>
To: jakub@gcc.gnu.org, gcc-bugs@gcc.gnu.org, gcc-prs@gcc.gnu.org,
	lucho@haemimont.bg, nobody@gcc.gnu.org, gcc-gnats@gcc.gnu.org
Cc:  
Subject: Re: optimization/6398: faulty code when inlining in a var-arged function
Date: Mon, 22 Apr 2002 18:45:29 +0300

 This is a multi-part message in MIME format.
 --------------010302030908040209010702
 Content-Type: text/plain; charset=us-ascii; format=flowed
 Content-Transfer-Encoding: 7bit
 
 here is the preprocessed source (as attachment)
 i haven't installed other gcc than 3.0 yet and so cannot test other versions
 
 --------------010302030908040209010702
 Content-Type: text/plain;
  name="bug.i"
 Content-Transfer-Encoding: 7bit
 Content-Disposition: inline;
  filename="bug.i"
 
 # 1 "bug.c"
 # 1 "/usr/lib/gcc-lib/i686-pc-linux-gnu/3.0/include/stdarg.h" 1 3
 # 43 "/usr/lib/gcc-lib/i686-pc-linux-gnu/3.0/include/stdarg.h" 3
 typedef __builtin_va_list __gnuc_va_list;
 # 110 "/usr/lib/gcc-lib/i686-pc-linux-gnu/3.0/include/stdarg.h" 3
 typedef __gnuc_va_list va_list;
 # 2 "bug.c" 2
 
 
 static void f1(int p, char *fmt, va_list args)
 {
         char *hdr[2] = {"AAAA", "BBBB"};
         char buf[128];
         int l;
 
         if (p > 2) return;
         l = strlen(hdr[p]);
         memcpy(buf, hdr[p], l);
         vsnprintf(buf + l, 128 - l, fmt, args);
         puts(buf);
 }
 
 void f2(int p, char *fmt, ...)
 {
         va_list args;
         __builtin_stdarg_start((args),fmt);
         f1(p, fmt, args);
         __builtin_va_end(args);
 }
 
 int main()
 {
         f2(0, "xyz");
         return 0;
 }
 
 --------------010302030908040209010702--
 


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