public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug optimization/13000] New: Using -Ox cannot detect missing return statement in a function
@ 2003-11-10 23:07 cheng at powertv dot com
2005-01-21 19:07 ` [Bug tree-optimization/13000] [3.4 Regression] [unit-at-a-time] Using -O2 " ian at airs dot com
` (6 more replies)
0 siblings, 7 replies; 9+ messages in thread
From: cheng at powertv dot com @ 2003-11-10 23:07 UTC (permalink / raw)
To: gcc-bugs
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
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug tree-optimization/13000] [3.4 Regression] [unit-at-a-time] Using -O2 cannot detect missing return statement in a function
2003-11-10 23:07 [Bug optimization/13000] New: Using -Ox " cheng at powertv dot com
@ 2005-01-21 19:07 ` ian at airs dot com
2005-01-21 19:14 ` ian at airs dot com
` (5 subsequent siblings)
6 siblings, 0 replies; 9+ messages in thread
From: ian at airs dot com @ 2005-01-21 19:07 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From ian at airs dot com 2005-01-21 19:07 -------
Fixed on mainline.
--
What |Removed |Added
----------------------------------------------------------------------------
Known to fail|4.0.0 3.4.0 |3.4.0
Known to work|3.3 |3.3 4.0.0
Summary|[3.4/4.0 Regression] [unit- |[3.4 Regression] [unit-at-a-
|at-a-time] Using -O2 cannot |time] Using -O2 cannot
|detect missing return |detect missing return
|statement in a function |statement in a function
Target Milestone|4.0.0 |3.4.4
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=13000
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug tree-optimization/13000] [3.4 Regression] [unit-at-a-time] Using -O2 cannot detect missing return statement in a function
2003-11-10 23:07 [Bug optimization/13000] New: Using -Ox " cheng at powertv dot com
2005-01-21 19:07 ` [Bug tree-optimization/13000] [3.4 Regression] [unit-at-a-time] Using -O2 " 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
` (4 subsequent siblings)
6 siblings, 0 replies; 9+ messages in thread
From: ian at airs dot com @ 2005-01-21 19:14 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From ian at airs dot com 2005-01-21 19:14 -------
Note that if we do move to a better solution, i.e., building a CFG for inline
functions, we should remove the patch to c_finish_bc_stmt in c-typeck.c. It
prevents -Wunreachable from ever warning about an unreachable break or continue
statement (we currently do not issue a warning about those statements anyhow).
We may want to consider removing the patch to shortcut_cond_expr in gimplify.c,
although that one is relatively harmless.
And of course if we build a CFG, we should adjust the patch to
expand_call_inline, although that will probably be pretty obvious.
See the e-mail thread starting here:
http://gcc.gnu.org/ml/gcc-patches/2005-01/msg01223.html
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=13000
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug tree-optimization/13000] [3.4 Regression] [unit-at-a-time] Using -O2 cannot detect missing return statement in a function
2003-11-10 23:07 [Bug optimization/13000] New: Using -Ox " cheng at powertv dot com
2005-01-21 19:07 ` [Bug tree-optimization/13000] [3.4 Regression] [unit-at-a-time] Using -O2 " 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
` (3 subsequent siblings)
6 siblings, 0 replies; 9+ messages in thread
From: rth at gcc dot gnu dot org @ 2005-01-27 1:58 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From rth at gcc dot gnu dot org 2005-01-27 01:58 -------
I am uninterested in fixing this for 3.4.
--
What |Removed |Added
----------------------------------------------------------------------------
AssignedTo|rth at gcc dot gnu dot org |unassigned at gcc dot gnu
| |dot org
Status|ASSIGNED |NEW
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=13000
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug tree-optimization/13000] [3.4 Regression] [unit-at-a-time] Using -O2 cannot detect missing return statement in a function
2003-11-10 23:07 [Bug optimization/13000] New: Using -Ox " cheng at powertv dot com
` (2 preceding siblings ...)
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
` (2 subsequent siblings)
6 siblings, 0 replies; 9+ messages in thread
From: giovannibajo at libero dot it @ 2005-04-12 17:35 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From giovannibajo at libero dot it 2005-04-12 17:35 -------
Since this bug was fixed in 4.1, I'm removing the dependencies with the 4.1
metabug.
--
What |Removed |Added
----------------------------------------------------------------------------
OtherBugsDependingO|17652 |
nThis| |
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=13000
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug tree-optimization/13000] [3.4 Regression] [unit-at-a-time] Using -O2 cannot detect missing return statement in a function
2003-11-10 23:07 [Bug optimization/13000] New: Using -Ox " cheng at powertv dot com
` (3 preceding siblings ...)
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
6 siblings, 0 replies; 9+ messages in thread
From: ian at airs dot com @ 2005-04-12 18:49 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From ian at airs dot com 2005-04-12 18:49 -------
The dependency on 17652 is there because of comment #17, q.v. We want to make
sure that we back out the patch to c_finish_bc_stmt when it is no longer needed,
which should happen after the tree-profiling branch is merged to mainline. So
I'm re-adding the dependency. If you still think this is wrong, go ahead and
take it out.
--
What |Removed |Added
----------------------------------------------------------------------------
OtherBugsDependingO| |17652
nThis| |
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=13000
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug tree-optimization/13000] [3.4 Regression] [unit-at-a-time] Using -O2 cannot detect missing return statement in a function
2003-11-10 23:07 [Bug optimization/13000] New: Using -Ox " cheng at powertv dot com
` (4 preceding siblings ...)
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
6 siblings, 0 replies; 9+ messages in thread
From: mmitchel at gcc dot gnu dot org @ 2005-05-19 17:49 UTC (permalink / raw)
To: gcc-bugs
--
What |Removed |Added
----------------------------------------------------------------------------
Target Milestone|3.4.4 |3.4.5
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=13000
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug tree-optimization/13000] [3.4 Regression] [unit-at-a-time] Using -O2 cannot detect missing return statement in a function
2003-11-10 23:07 [Bug optimization/13000] New: Using -Ox " cheng at powertv dot com
` (5 preceding siblings ...)
2005-05-19 17:49 ` mmitchel at gcc dot gnu dot org
@ 2005-09-05 15:48 ` pinskia at gcc dot gnu dot org
6 siblings, 0 replies; 9+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-09-05 15:48 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From pinskia at gcc dot gnu dot org 2005-09-05 15:48 -------
(In reply to comment #20)
> The dependency on 17652 is there because of comment #17, q.v. We want to make
> sure that we back out the patch to c_finish_bc_stmt when it is no longer needed,
> which should happen after the tree-profiling branch is merged to mainline. So
> I'm re-adding the dependency. If you still think this is wrong, go ahead and
> take it out.
Removing dependent on 13127 because the patch to c_finish_bc_stmt still speeds up the compiling as
we don't need to generate as many BBs with it as we would without it.
--
What |Removed |Added
----------------------------------------------------------------------------
OtherBugsDependingO|17652 |
nThis| |
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=13000
^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2006-02-28 8:49 UTC | newest]
Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
[not found] <bug-13000-1556@http.gcc.gnu.org/bugzilla/>
2005-10-07 3:13 ` [Bug tree-optimization/13000] [3.4 Regression] [unit-at-a-time] Using -O2 cannot detect missing return statement in a function gdr at gcc dot gnu dot org
2006-02-28 8:51 ` gdr at gcc dot gnu dot org
2003-11-10 23:07 [Bug optimization/13000] New: Using -Ox " cheng at powertv dot com
2005-01-21 19:07 ` [Bug tree-optimization/13000] [3.4 Regression] [unit-at-a-time] Using -O2 " 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
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).