public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/15400] New: gcc accumulates instead of overlaying automatic variables
@ 2004-05-13 9:30 leblanc at skycomputers dot com
2004-05-13 10:05 ` [Bug c/15400] " pinskia at gcc dot gnu dot org
0 siblings, 1 reply; 2+ messages in thread
From: leblanc at skycomputers dot com @ 2004-05-13 9:30 UTC (permalink / raw)
To: gcc-bugs
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;
}
--
Summary: gcc accumulates instead of overlaying automatic
variables
Product: gcc
Version: 3.3
Status: UNCONFIRMED
Severity: critical
Priority: P1
Component: c
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: leblanc at skycomputers dot com
CC: gcc-bugs at gcc dot gnu dot org
GCC build triplet: ppc-*-linux
GCC host triplet: ppc-*-linux
GCC target triplet: ppc-*-linux
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=15400
^ permalink raw reply [flat|nested] 2+ messages in thread
* [Bug c/15400] gcc accumulates instead of overlaying automatic variables
2004-05-13 9:30 [Bug c/15400] New: gcc accumulates instead of overlaying automatic variables leblanc at skycomputers dot com
@ 2004-05-13 10:05 ` pinskia at gcc dot gnu dot org
0 siblings, 0 replies; 2+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-05-13 10:05 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From pinskia at gcc dot gnu dot org 2004-05-12 17:33 -------
This is not a bug per say really but it is bug 9997 anyways so closing as a dup.
*** This bug has been marked as a duplicate of 9997 ***
--
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |RESOLVED
Resolution| |DUPLICATE
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=15400
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2004-05-12 17:33 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-05-13 9:30 [Bug c/15400] New: gcc accumulates instead of overlaying automatic variables leblanc at skycomputers dot com
2004-05-13 10:05 ` [Bug c/15400] " pinskia 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).