public inbox for glibc-bugs@sourceware.org help / color / mirror / Atom feed
From: "suma dot sharma at kpitcummins dot com" <sourceware-bugzilla@sourceware.org> To: glibc-bugs@sources.redhat.com Subject: [Bug libc/4681] New: declaring Âstrcmp() as an extern function with inclusion of Âstring.h is causing compilation error Date: Thu, 21 Jun 2007 09:26:00 -0000 [thread overview] Message-ID: <20070621092629.4681.suma.sharma@kpitcummins.com> (raw) [-- Warning: decoded text below may be mangled, UTF-8 assumed --] [-- Attachment #1: Type: text/plain, Size: 2996 bytes --] Hi, I have successfully built SH4-Linux toolchain based on (binutils-2.17, gcc-4.2-20061205, glibc-2.5) for Renesas SH target. I am facing problems while compiling the following testcase- ------------------------------------------------------------------ TESTCASE #include<string.h> #include<stdio.h> extern int strcmp(const char *,const char *); int main() { char s1[3]; char s2[3]; strcpy(s1,"12"); strcpy(s2,"2"); printf("\n\t %d",strcmp(s1,s2)); return 0; } ------------------------------------------------------------------------- PROBLEM The above testcase gets compiled with '-O0' optimization successfully---- /sh4-linux-gcc testcase.c o a.out O0 but on compilation with '-O2' optimization option------ /sh4-linux-gcc testcase.c o a.out O2 it gives the following error:- testcase.c:4: error: expected identifier or ( before __extension__ testcase.c:4: error: expected identifier or ( before ) token OBSERVATIONS 1. In the above testcase, declaring strcmp() as an extern function with inclusion of string.h is causing the above mentioned compilation error. But on the other hand, if either of the two scenarios is used i.e. either string.h is included or strcmp() is declared as an extern function only, then it compiles successfully with O2 option. 2. This problem has been observed with sh-linux toolchain (gcc-4.2) i686-pc-linux toolchain (gcc-4.1.1, Fedora Core 6) i686-pc-linux toolchain (gcc-4.2.0) Any help on this will be appreciated. Regards, Suma Sharma KPIT Cummins Infosystems Ltd, Pune (INDIA) ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Free download of GNU based SH-Linux toolchains for Renesas' SH Series. The following site also offers free technical support to its users. Visit http://www.kpitgnutools.com for details. Latest versions of KPIT GNU SH-Linux tools were released on April 5, 2007. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -- Summary: declaring strcmp() as an extern function with inclusion of string.h is causing compilation error Product: glibc Version: unspecified Status: NEW Severity: normal Priority: P3 Component: libc AssignedTo: drepper at redhat dot com ReportedBy: suma dot sharma at kpitcummins dot com CC: glibc-bugs at sources dot redhat dot com,suma dot sharma at kpitcummins dot com GCC build triplet: i686-pc-linux GCC host triplet: sh4-unknown-linux GCC target triplet: sh4-unknown-linux http://sourceware.org/bugzilla/show_bug.cgi?id=4681 ------- You are receiving this mail because: ------- You are on the CC list for the bug, or are watching someone who is.
next reply other threads:[~2007-06-21 9:26 UTC|newest] Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top 2007-06-21 9:26 suma dot sharma at kpitcummins dot com [this message] 2007-06-21 9:37 ` [Bug libc/4681] declaring strcmp() as an extern function with inclusion of string.h " jakub at redhat dot com 2007-06-21 10:59 ` suma dot sharma at kpitcummins dot com 2007-07-02 15:56 ` jakub at redhat 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=20070621092629.4681.suma.sharma@kpitcummins.com \ --to=sourceware-bugzilla@sourceware.org \ --cc=glibc-bugs@sources.redhat.com \ /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).