public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "tmsriram at google dot com" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug target/61599] New: [x86_64] With -mcmodel=medium, extern global arrays without size are not treated conservatively. Date: Tue, 24 Jun 2014 17:32:00 -0000 [thread overview] Message-ID: <bug-61599-4@http.gcc.gnu.org/bugzilla/> (raw) https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61599 Bug ID: 61599 Summary: [x86_64] With -mcmodel=medium, extern global arrays without size are not treated conservatively. Product: gcc Version: 4.10.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: target Assignee: unassigned at gcc dot gnu.org Reporter: tmsriram at google dot com CC: davidxl at google dot com, ppluzhnikov at google dot com foo.cc ====== char c[1*1024*1024*1024]; extern int bar(); int main() { return bar() + c[225]; } bar.cc ====== extern char c[]; int bar() { return c[225]; } $ g++ -mcmodel=medium foo.cc bar.cc -fdata-sections BFD linker warns: bar.cc:(.text+0x7): relocation truncated to fit: R_X86_64_PC32 against symbol `c' defined in .lbss.c section in foo.o Reason is the compiler does not treat 'c' conservatively as being in .lbss when it does not know its size. Worse, adding -mlarge-data-threshold=0 still does not solve the problem. Changing the declaration "extern char c[]" to "extern char c[1*1024*1024*1024]" solves the problem.
next reply other threads:[~2014-06-24 17:32 UTC|newest] Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top 2014-06-24 17:32 tmsriram at google dot com [this message] 2014-07-09 0:51 ` [Bug target/61599] " tmsriram at gcc dot gnu.org 2014-09-16 17:51 ` tmsriram at google dot com 2015-01-30 20:00 ` ubizjak at gmail dot com
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=bug-61599-4@http.gcc.gnu.org/bugzilla/ \ --to=gcc-bugzilla@gcc.gnu.org \ --cc=gcc-bugs@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).