public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* gcc accumulates instead of overlaying frame variables
@ 2004-05-13  9:29 Michael LeBlanc
  2004-05-13  9:43 ` Andrew Pinski
  2004-05-17 13:40 ` Jim Wilson
  0 siblings, 2 replies; 3+ messages in thread
From: Michael LeBlanc @ 2004-05-13  9:29 UTC (permalink / raw)
  To: gcc-bugs

[-- Attachment #1: Type: text/plain, Size: 2495 bytes --]

I am submitting this as instructed, as a last resort, because

(1) I can't figure out how to attach files in the bugzilla page; and
(2) I can't find a gccbug script in a 3.3 source package.

So here are the things from

	gcc -v -save-temps x.c f.c

$ tar tvf gnu.tar
drwxrwxr-x leblanc/leblanc   0 2004-05-12 12:50:24 ./
-rw-rw-r-- leblanc/leblanc 152 2004-05-12 12:12:33 ./x.c
-rw-rw-r-- leblanc/leblanc  76 2004-05-12 12:10:54 ./f.c
-rw-rw-r-- leblanc/leblanc 207 2004-05-12 12:49:20 ./x.i
-rw-rw-r-- leblanc/leblanc 367 2004-05-12 12:49:20 ./x.s
-rw-rw-r-- leblanc/leblanc 134 2004-05-12 12:49:20 ./f.i
-rw-rw-r-- leblanc/leblanc 437 2004-05-12 12:49:20 ./f.s
-rw-rw-r-- leblanc/leblanc 2776 2004-05-12 12:49:20 ./stderr

See the source down below.  SUN and Metaware believe, correctly, that 
the
two blocks overlay each other in the final stack frame.  GCC adds them
together.  It looks like this mistake has been around for quite a while.

(1) on Solaris

     SUN
         % /opt/SUNWspro/bin/cc -V
         cc: Sun WorkShop 6 2000/04/07 C 5.1

         % /opt/SUNWspro/bin/cc x.c f.c
         x.c:
         f.c:

         % ./a.out
         frame is about 612 bytes
         frame is about 612 bytes

     HighC
         % hc x.c f.c -Hcopyr
         x.c:
         MetaWare High C Compiler R2.8   Serial 1-SKY-799999.
         (c) Copyright 1987-98, MetaWare Incorporated
         f.c:
         w "f.c",L4/C3(#291):    printf: Function called but not 
declared.
         No errors   1 warning

         % ./a.out
         frame is about 608 bytes
         frame is about 608 bytes

     GCC
         % gcc -v
         Reading specs from 
/usr/local/lib/gcc-lib/sparc-sun-solaris2.8/2.95.3/specs
         gcc version 2.95.3 20010315 (release)

         % gcc x.c f.c

         % ./a.out
         frame is about 1136 bytes
         frame is about 624 bytes
(2) on YDL 3.0

         $ gcc -v
         ...
         gcc version 3.3

         $ gcc x.c f.c

         $ ./a.out
         frame is about 547 bytes
         frame is about 1059 bytes

SOURCE

         % cat f.c
         void foo(char *p)
         {
           char x;
           printf("frame is about %d bytes\n",p-&x);
         }

         % cat x.c

         #define N 512

         extern void foo(char *p);

         int main()
         {
           {
             char x[N];
             foo(&x[N-1]);
           }
           {
             char x[N];
             foo(&x[N-1]);
           }
           return 0;
         }


[-- Attachment #2: gnu.tar --]
[-- Type: application/x-tar, Size: 20480 bytes --]

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

* Re: gcc accumulates instead of overlaying frame variables
  2004-05-13  9:29 gcc accumulates instead of overlaying frame variables Michael LeBlanc
@ 2004-05-13  9:43 ` Andrew Pinski
  2004-05-17 13:40 ` Jim Wilson
  1 sibling, 0 replies; 3+ messages in thread
From: Andrew Pinski @ 2004-05-13  9:43 UTC (permalink / raw)
  To: Michael LeBlanc; +Cc: gcc-bugs, Andrew Pinski


On May 12, 2004, at 13:16, Michael LeBlanc wrote:

> I am submitting this as instructed, as a last resort, because
>
> (1) I can't figure out how to attach files in the bugzilla page; and
> (2) I can't find a gccbug script in a 3.3 source package.
>
> So here are the things from
>
> 	gcc -v -save-temps x.c f.c
>
> $ tar tvf gnu.tar
> drwxrwxr-x leblanc/leblanc   0 2004-05-12 12:50:24 ./
> -rw-rw-r-- leblanc/leblanc 152 2004-05-12 12:12:33 ./x.c
> -rw-rw-r-- leblanc/leblanc  76 2004-05-12 12:10:54 ./f.c
> -rw-rw-r-- leblanc/leblanc 207 2004-05-12 12:49:20 ./x.i
> -rw-rw-r-- leblanc/leblanc 367 2004-05-12 12:49:20 ./x.s
> -rw-rw-r-- leblanc/leblanc 134 2004-05-12 12:49:20 ./f.i
> -rw-rw-r-- leblanc/leblanc 437 2004-05-12 12:49:20 ./f.s
> -rw-rw-r-- leblanc/leblanc 2776 2004-05-12 12:49:20 ./stderr
>
> See the source down below.  SUN and Metaware believe, correctly, that 
> the
> two blocks overlay each other in the final stack frame.  GCC adds them
> together.  It looks like this mistake has been around for quite a 
> while.



This is not a bug per say really but it is bug 9997 anyways.

Thanks,
Andrew Pinski


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

* Re: gcc accumulates instead of overlaying frame variables
  2004-05-13  9:29 gcc accumulates instead of overlaying frame variables Michael LeBlanc
  2004-05-13  9:43 ` Andrew Pinski
@ 2004-05-17 13:40 ` Jim Wilson
  1 sibling, 0 replies; 3+ messages in thread
From: Jim Wilson @ 2004-05-17 13:40 UTC (permalink / raw)
  To: Michael LeBlanc; +Cc: gcc-bugs

Michael LeBlanc wrote:
> (1) I can't figure out how to attach files in the bugzilla page; and

Create a bug report without a testcase, wait for the confirmation 
message, then visit the URL for the bug and click on the link "Create a 
New Attachment".  Admittedly this is not ideal, but it does work.

> (2) I can't find a gccbug script in a 3.3 source package.

The gccbug script is created when you build gcc, from the gccbug.in 
source file.
-- 
Jim Wilson, GNU Tools Support, http://www.SpecifixInc.com


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

end of thread, other threads:[~2004-05-16 23:59 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-05-13  9:29 gcc accumulates instead of overlaying frame variables Michael LeBlanc
2004-05-13  9:43 ` Andrew Pinski
2004-05-17 13:40 ` Jim Wilson

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).