Bug 8602 - [3.2/3.3/3.4 regression] incorrect line numbers in warning messages when using inline functions
Summary: [3.2/3.3/3.4 regression] incorrect line numbers in warning messages when usin...
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: c (show other bugs)
Version: 3.2.1
: P3 normal
Target Milestone: ---
Assignee: Richard Henderson
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2002-11-16 02:06 UTC by 153965
Modified: 2004-01-17 04:22 UTC (History)
4 users (show)

See Also:
Host: i386-linux
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description 153965 2002-11-16 02:06:02 UTC
[ Reported to the Debian BTS as report #153965.
  Please CC 153965@bugs.debian.org on replies.
  Log of report can be found at http://bugs.debian.org/153965 ]
-----
static inline int
foo(int x)
{
  if (!x)
    return 0;
}

int main(void)
{
  foo(1);
  return 1;
}
-----

$ gcc-2.95 -Wall -c !$
gcc-2.95 -Wall -c bug-153965.c
bug-153965.c: In function `foo':
bug-153965.c:6: warning: control reaches end of non-void function
            ^^^
$ gcc-3.2 -Wall -c bug-153965.c
bug-153965.c: In function `foo':
bug-153965.c:13: warning: control reaches end of non-void function
            ^^^^
$ gcc-3.3 -Wall -c bug-153965.c
bug-153965.c: In function `foo':
bug-153965.c:13: warning: control reaches end of non-void function
           ^^^^^
gcc 3.[23] also produces correct line numbers if either "static" or
"inline" is removed from foo. Removing the body of function foo()
causes a secondary warning to be generated in the right place, but the
original warning still has the wrong line number.

[gcc-3.2 is gcc-3.2.1 20021111, gcc-3.3 is HEAD 20021103]

Release:
3.2.1 (Debian) (Debian unstable)

Environment:
System: Debian GNU/Linux (unstable)
Architecture: i686
host: i386-linux
Configured with: /home/packages/gcc/3.2/gcc-3.2-3.2.1ds5/src/configure -v --enable-languages=c,c++,java,f77,proto,objc,ada --prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info --with-gxx-include-dir=/usr/include/c++/3.2 --enable-shared --with-system-zlib --enable-nls --without-included-gettext --enable-__cxa_atexit --enable-clocale=gnu --enable-java-gc=boehm --enable-objc-gc i386-linux
Comment 1 Neil Booth 2002-11-16 03:23:59 UTC
State-Changed-From-To: open->analyzed
State-Changed-Why: Confirmed.  Change category to C as it clearly has nothing to do with preprocessor.
Comment 2 janis187 2003-01-15 09:08:29 UTC
From: Janis Johnson <janis187@us.ibm.com>
To: gcc-gnats@gcc.gnu.org, gcc-prs@gcc.gnu.org, asuffield@debian.org,
   153965@bugs.debian.org, gcc-bugs@gcc.gnu.org, nobody@gcc.gnu.org
Cc:  
Subject: Re: c/8602: [3.2/3.3 regression] incorrect line numbers in warning 
 messages when using inline functions
Date: Wed, 15 Jan 2003 09:08:29 -0800

 The regression was introduced with this patch:
 
 --- gcc/ChangeLog ---
 2000-10-05  Richard Henderson  <rth@cygnus.com>
 
       * c-decl.c (warn_missing_noreturn): Remove.
       (c_expand_body): Don't set or check can_reach_end.
       * c-tree.h (warn_missing_noreturn): Move ...
       * flags.h: ... here.
       (can_reach_end): Remove.
       * flow.c (check_function_return_warnings): New.
       (make_edges): No edge to exit for noreturn sibcalls.
       * function.c (expand_function_end): Save the return value
       clobber instruction.
       (mark_function_status): Mark it.
       * function.h (struct function): Add x_clobber_return_insn.
       * jump.c (can_reach_end): Remove.
       (calculate_can_reach_end): Remove.
       (jump_optimize_1): Don't call it.
       * output.h (check_function_return_warnings): Declare.
       * toplev.c (warn_missing_noreturn): Move from c-decl.c
       (rest_of_compilation): Call check_function_return_warnings.
 
 http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&pr=8602
 
 
 
Comment 3 Richard Henderson 2003-02-06 00:39:25 UTC
Responsible-Changed-From-To: unassigned->rth
Responsible-Changed-Why: .
Comment 4 Richard Henderson 2003-02-06 00:39:25 UTC
State-Changed-From-To: analyzed->closed
State-Changed-Why: http://gcc.gnu.org/ml/gcc-patches/2003-01/msg01914.html
Comment 5 s.bosscher 2003-02-22 15:10:41 UTC
From: Steven Bosscher <s.bosscher@student.tudelft.nl>
To: gcc-gnats@gcc.gnu.org, gcc-bugs@gcc.gnu.org,
	asuffield@debian.org, gcc-prs@gcc.gnu.org, 153965@bugs.debian.org,
	rth@gcc.gnu.org, doko@cs.tu-berlin.de
Cc:  
Subject: Re: c/8602: [3.2/3.3/3.4 regression] incorrect line numbers in warning
 messages when using inline functions
Date: Sat, 22 Feb 2003 15:10:41 +0100

 http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&pr=8602
 
 Could this patch by any change have fixed the actual issue?
 http://gcc.gnu.org/ml/gcc-patches/2003-02/msg01957.html
 

Comment 6 Richard Henderson 2003-03-20 23:20:05 UTC
From: rth@gcc.gnu.org
To: gcc-gnats@gcc.gnu.org
Cc:  
Subject: c/8602
Date: 20 Mar 2003 23:20:05 -0000

 CVSROOT:	/cvs/gcc
 Module name:	gcc
 Branch: 	gcc-3_3-branch
 Changes by:	rth@gcc.gnu.org	2003-03-20 23:20:05
 
 Modified files:
 	gcc            : ChangeLog integrate.c 
 
 Log message:
 	PR c/8602
 	* integrate.c (output_inline_function): Reset input_filename
 	and lineno from the decl before rest_of_compilation.
 
 Patches:
 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/ChangeLog.diff?cvsroot=gcc&only_with_tag=gcc-3_3-branch&r1=1.16114.2.329&r2=1.16114.2.330
 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/integrate.c.diff?cvsroot=gcc&only_with_tag=gcc-3_3-branch&r1=1.206.2.2&r2=1.206.2.3