public inbox for gcc-prs@sourceware.org
help / color / mirror / Atom feed
* Re: c/10697: linker problem with global variable
@ 2003-05-09 9:32 ehrhardt
0 siblings, 0 replies; 2+ messages in thread
From: ehrhardt @ 2003-05-09 9:32 UTC (permalink / raw)
To: bhuang, gcc-bugs, gcc-prs, nobody
Synopsis: linker problem with global variable
State-Changed-From-To: open->closed
State-Changed-By: cae
State-Changed-When: Fri May 9 09:32:40 2003
State-Changed-Why:
Duplicate of 10696.
http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&pr=10697
^ permalink raw reply [flat|nested] 2+ messages in thread
* c/10697: linker problem with global variable
@ 2003-05-09 7:06 bhuang
0 siblings, 0 replies; 2+ messages in thread
From: bhuang @ 2003-05-09 7:06 UTC (permalink / raw)
To: gcc-gnats
>Number: 10697
>Category: c
>Synopsis: linker problem with global variable
>Confidential: no
>Severity: serious
>Priority: medium
>Responsible: unassigned
>State: open
>Class: pessimizes-code
>Submitter-Id: net
>Arrival-Date: Fri May 09 07:06:01 UTC 2003
>Closed-Date:
>Last-Modified:
>Originator: falls huang <bhuang@qubit-star.com>
>Release: gcc version 3.1 20020927 ; gcc version 3.2
>Organization:
>Environment:
redhat 8.0, redhat 9.0, cygwin
>Description:
foo.h:
/*********/
int foo_global;
void f(void);
/*********/
a.c:
/*********/
#include "foo.h"
int main()
{
foo_global = 5;
printf("foo_global=%d\n",foo_global);
f();
printf("foo_global=%d\n",foo_global);
return 0;
}
/*********/
b.c:
/*********/
#include "foo.h"
void f(void)
{
foo_global = -1;
}
/*********/
Makefile:
all:
gcc -c b.c
gcc -c a.c
gcc -o test a.o b.o
gcc -o test1 -ansic a.c b.c
clean:
rm -f *.o *.exe test test1
I type "make" in console and compile the program
without any warning and error. But I can't compile it
successfully in TurboC3.0 and Borland C.The
foo_global that defined in foo.h is included in a.c
and b.c, so I think the linker should report an error
when I link a.o and b.o , but gcc doesn't give any
warning and error.
>How-To-Repeat:
Create foo.h a.c b.c makefile from my description and type "make" to compile it.
>Fix:
>Release-Note:
>Audit-Trail:
>Unformatted:
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2003-05-09 9:32 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-05-09 9:32 c/10697: linker problem with global variable ehrhardt
-- strict thread matches above, loose matches on Subject: below --
2003-05-09 7:06 bhuang
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).