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
  2003-11-10 23:13 ` [Bug optimization/13000] " pinskia at gcc dot gnu dot org
                   ` (25 more replies)
  0 siblings, 26 replies; 29+ 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] 29+ messages in thread
[parent not found: <bug-13000-1556@http.gcc.gnu.org/bugzilla/>]

end of thread, other threads:[~2006-02-28  8:49 UTC | newest]

Thread overview: 29+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-11-10 23:07 [Bug optimization/13000] New: Using -Ox cannot detect missing return statement in a function cheng at powertv dot com
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
     [not found] <bug-13000-1556@http.gcc.gnu.org/bugzilla/>
2005-10-07  3:13 ` gdr at gcc dot gnu dot org
2006-02-28  8:51 ` gdr 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).