public inbox for gcc-prs@sourceware.org help / color / mirror / Atom feed
From: jmortensen@cfl.rr.com To: gcc-gnats@gcc.gnu.org Subject: middle-end/10875: There is no multiple symbol definition error or warning for global symbols Date: Mon, 19 May 2003 22:06:00 -0000 [thread overview] Message-ID: <20030519220253.3946.qmail@sources.redhat.com> (raw) [-- Warning: decoded text below may be mangled, UTF-8 assumed --] [-- Attachment #1: Type: text/plain, Size: 1394 bytes --] >Number: 10875 >Category: middle-end >Synopsis: There is no multiple symbol definition error or warning for global symbols >Confidential: no >Severity: non-critical >Priority: medium >Responsible: unassigned >State: open >Class: change-request >Submitter-Id: net >Arrival-Date: Mon May 19 22:06:00 UTC 2003 >Closed-Date: >Last-Modified: >Originator: Jose Mortensen >Release: gcc 3.2.1 >Organization: >Environment: debian linux 2.4.19, HPUX B.10.20 (gcc 2.95.2) >Description: Two globals with the same name but different types declared in different files are resolved by the linker as one variable without an error or warning message. 1. Conflicting types should give an error. I dont know if this is actually allowed in ansi-C 2. Looks like Ansi-C takes this kind of code as declaration if it has already been defined, but would be handy if it could at least give a warning. A simplified example is given below: // file1.c #include <stdio.h> int* var; void other_function(){ var = NULL; } // file2.c #include <stdio.h> void other_function(); int var; int main(int argc, char** argv) { var = 1; other_function(); printf("%d\n", var); } >How-To-Repeat: just cut and paste the code given above and run gcc > gcc file1.c file2.c >Fix: coding carefully >Release-Note: >Audit-Trail: >Unformatted:
reply other threads:[~2003-05-19 22:06 UTC|newest] Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=20030519220253.3946.qmail@sources.redhat.com \ --to=jmortensen@cfl.rr.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).