🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: gnu.g++.bug
Article #1233

Extraneous warning message

#1233
From: mrhagger
Date: Mon, 23 Nov 1992 06:11
45 lines
1951 bytes
I have found a simple C++ program which causes gcc to output an extraneous
warning message.  I am using emx version 0.8e for OS/2, under OS/2 v. 2.0.
The code and compiler output follow:
 
bug3.cc -----------------------------------------------------------------
#include <complex.h>
 
double foo(complex *a)
{
  return 0.0;
}
 
 
double bar(void)
{
  complex v[10];
  return foo(v);
}
 
 
-------------------------------------------------------------------------
Compiler output ---------------------------------------------------------
[c:\emx\gnu\bugs]gcc -v -Wall -c bug3.cc 2>bug3.rpt
gcc version 2.2.2
 cpp -lang-c++ -v -undef -D__GNUC__=2 -D__GNUG__=2 -D__cplusplus -D__32BIT__ 
 -D__EMX__ -Di386 -D__32BIT__ -D__EMX__ -D__i386__ -D__32BIT__ -D__EMX__ 
 -D__i386 -Wall bug3.cc ./cca00078.i
GNU CPP version 2.2.2 (80386, BSD syntax)
 cc1plus ./cca00078.i -quiet -dumpbase bug3.cc -Wall -version -o ./cca00078.s
GNU C++ version 2.2.2 (80386, BSD syntax) compiled by GNU C version 2.2.2.
bug3.cc: In function `double  bar ()':
bug3.cc:13: warning: control reaches end of non-void function
 as -o bug3.o ./cca00078.s
 
[c:\emx\gnu\bugs]
-------------------------------------------------------------------------
 
I haven't checked whether the destructors for the array are called, but
the function bar() DOES return the correct result (also for non-trivial
return values, like in the longer program that this example is boiled down 
from).
 
Yours,
Michael Haggerty
mrhagger@athena.mit.edu
Technical Details
Message-ID: <9211230611.AA04039@e40-008-11.MIT.EDU>
Path: arc1-ca.pugleaf.net!sparky!uunet!cs.utexas.edu!zaphod.mps.ohio-state.edu!cis.ohio-state.edu!athena.mit.edu!mrhagger

Show Full Headers
Complete Article Headers
Newsgroups: gnu.g++.bug
Path: arc1-ca.pugleaf.net!sparky!uunet!cs.utexas.edu!zaphod.mps.ohio-state.edu!cis.ohio-state.edu!athena.mit.edu!mrhagger
From: mrhagger@athena.mit.edu
Subject: Extraneous warning message
Message-ID: <9211230611.AA04039@e40-008-11.MIT.EDU>
Sender: gnulists@ai.mit.edu
Organization: GNUs Not Usenet
Distribution: gnu
Date: Mon, 23 Nov 1992 06:11:11 GMT
Approved: bug-g++@prep.ai.mit.edu
Lines: 46