🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: gnu.gcc.bug
Article #400

Spurious warning from gcc-2.1 with -g -Wall but without -O

#400
From: Ian Lance Taylor
Date: Tue, 14 Apr 1992 12:22
32 lines
1223 bytes
I am using gcc 2.1 configured as decstation-3100.  If the following
program is compiled with -g -Wall but without -O, it gives the
spurious error

    foo.c: In function `f':
    foo.c:25: warning: control reaches end of non-void function

This error does not appear if -O is specified, and it does not appear
if -g is not specified.

int f (int a, int b)
{
  if (a)
    {
      if (b)
	return 0;
      else
	return 1;
    }
  else
    {
      if (b)
	return 2;
      else
	return 3;
    }
}
-- 
Ian Taylor                     ian@airs.com                    uunet!airs!ian
First person to identify this quote wins a free e-mail message:
``Do you make a grievance of weighing so many pounds only, instead of three
  hundred?  Then why fret about living so many years only, instead of more?''
Technical Details
Message-ID: <9204142022.AA16664@comton.airs.com>
Path: arc1-ca.pugleaf.net!sparky!uunet!cis.ohio-state.edu!airs.COM!ian

Show Full Headers
Complete Article Headers
Newsgroups: gnu.gcc.bug
Path: arc1-ca.pugleaf.net!sparky!uunet!cis.ohio-state.edu!airs.COM!ian
From: ian@airs.COM (Ian Lance Taylor)
Subject: Spurious warning from gcc-2.1 with -g -Wall but without -O
Message-ID: <9204142022.AA16664@comton.airs.com>
Sender: gnulists@ai.mit.edu
Organization: GNUs Not Usenet
Distribution: gnu
Date: Tue, 14 Apr 1992 12:22:11 GMT
Approved: bug-gcc@prep.ai.mit.edu
Lines: 33