public inbox for gcc-prs@sourceware.org help / color / mirror / Atom feed
From: bhuang@qubit-star.com To: gcc-gnats@gcc.gnu.org Subject: c/10696: linker problem with global variable Date: Fri, 09 May 2003 07:06:00 -0000 [thread overview] Message-ID: <20030509070259.12426.qmail@sources.redhat.com> (raw) >Number: 10696 >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:
next reply other threads:[~2003-05-09 7:06 UTC|newest] Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top 2003-05-09 7:06 bhuang [this message] 2003-05-09 9:32 ehrhardt 2003-05-09 11:26 Joseph S. Myers
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20030509070259.12426.qmail@sources.redhat.com \ --to=bhuang@qubit-star.com \ --cc=gcc-gnats@gcc.gnu.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
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).