incorrect line numbers in warning messages when using inline functions
>Submitter-Id: net
>Originator: Andrew Suffield <asuffield@debian.org>
>Organization: The Debian Project
>Confidential: no
>Synopsis:
>Severity: serious
>Priority: medium
>Category: preprocessor
>Class: sw-bug
>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
>Description:
[ 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]
>How-To-Repeat:
>Fix:
Reply to: