public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "cheng at powertv dot com" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug optimization/13000] New: Using -Ox cannot detect missing return statement in a function Date: Mon, 10 Nov 2003 23:07:00 -0000 [thread overview] Message-ID: <20031110230703.13000.cheng@powertv.com> (raw) In the following contrived code snippet, gcc 2.953 will not complain about the function not returning a value despite its function signature says so when compiling with optimizations enabled (e.g. -O1 or -O2). Disabling optimizations with -O0 will enable the compiler to display an appropriate error message. This problem appears in both C and C++ test code. typedef int ui32; static ui32 AddPrimitiveDvrResource(ui32 hSession, ui32 *pSessNode, void *pvResourceDescriptor, ui32 dwSize); static ui32 AddPrimitiveDvrResource(ui32 hSession, ui32 *pSessNode, void *pvResourceDescriptor, ui32 dwSize) { ui32 rc; if (dwSize != 32) { rc = 0; } else { // set the DVR ID in the session node even if subsequent steps fail if (dwSize) { rc = dwSize; } else { if (!pSessNode) { rc = 2; } else { ui32 dwTranscryptorAvrID = 0; if (rc = dwTranscryptorAvrID) { dwTranscryptorAvrID; } else { ui32 dk; if (rc = 16) { dk = rc; } else { if (dk) { rc = 1; } else { rc = 0; } } } } } } } int main(int argc, char **argv) { int result = AddPrimitiveDvrResource(0,0,0,0); return 0; } -- Summary: Using -Ox cannot detect missing return statement in a function Product: gcc Version: 2.95.3 Status: UNCONFIRMED Severity: normal Priority: P2 Component: optimization AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: cheng at powertv dot com CC: gcc-bugs at gcc dot gnu dot org http://gcc.gnu.org/bugzilla/show_bug.cgi?id=13000
next reply other threads:[~2003-11-10 23:07 UTC|newest] Thread overview: 27+ messages / expand[flat|nested] mbox.gz Atom feed top 2003-11-10 23:07 cheng at powertv dot com [this message] 2003-11-10 23:13 ` [Bug optimization/13000] " pinskia at gcc dot gnu dot org 2003-11-10 23:29 ` falk dot hueffner at student dot uni-tuebingen dot de 2003-11-10 23:36 ` [Bug optimization/13000] [tree-ssa] " pinskia at gcc dot gnu dot org 2003-11-11 0:20 ` pinskia at gcc dot gnu dot org 2003-11-19 15:05 ` steven at gcc dot gnu dot org 2003-12-01 4:34 ` [Bug optimization/13000] [3.4 Regression] " pinskia at gcc dot gnu dot org 2003-12-25 0:27 ` [Bug optimization/13000] [3.4 Regression] Using -O2 " pinskia at gcc dot gnu dot org 2003-12-25 0:39 ` [Bug optimization/13000] [3.4 Regression] [unit-at-a-time] " pinskia at gcc dot gnu dot org 2003-12-25 16:21 ` hubicka at ucw dot cz 2003-12-29 18:14 ` pinskia at gcc dot gnu dot org 2004-01-03 21:21 ` hubicka at gcc dot gnu dot org 2004-02-14 21:21 ` [Bug optimization/13000] [3.4/3.5 " pinskia at gcc dot gnu dot org 2004-08-18 7:35 ` [Bug tree-optimization/13000] " rth at gcc dot gnu dot org 2004-11-21 14:10 ` [Bug tree-optimization/13000] [3.4/4.0 " pinskia at gcc dot gnu dot org 2005-01-18 0:40 ` pinskia at gcc dot gnu dot org 2005-01-19 15:51 ` ian at airs dot com 2005-01-21 2:52 ` ian at airs dot com 2005-01-21 19:06 ` cvs-commit at gcc dot gnu dot org 2005-01-21 19:06 ` cvs-commit at gcc dot gnu dot org 2005-01-21 19:07 ` [Bug tree-optimization/13000] [3.4 " ian at airs dot com 2005-01-21 19:14 ` ian at airs dot com 2005-01-27 1:58 ` rth at gcc dot gnu dot org 2005-04-12 17:35 ` giovannibajo at libero dot it 2005-04-12 18:49 ` ian at airs dot com 2005-05-19 17:49 ` mmitchel at gcc dot gnu dot org 2005-09-05 15:48 ` pinskia at gcc dot gnu dot org
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=20031110230703.13000.cheng@powertv.com \ --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).