[Bug c/33763] [4.6/4.7/4.8 Regression] Bogus inlining failed in call to `xxx': redefined extern inline functions are not considered for inlining

2013-09-20 Thread kaltsi+gnu at gmail dot com
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=33763

Juha Kallioinen  changed:

   What|Removed |Added

 CC||kaltsi+gnu at gmail dot com

--- Comment #41 from Juha Kallioinen  ---
Maybe this failure with a newly built gcc 4.8 is related to this bug.

Built gcc today from
commit a846b696b9f3e9b9caab7e43ef8450cbded2715c
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/gcc-4_8-branch@202762
138bc75d-0d04-0410-961f-82ee72b

~/gcc48/bin$ ./gcc -v
Using built-in specs.
COLLECT_GCC=./gcc
COLLECT_LTO_WRAPPER=/home/kaltsi/gcc48/libexec/gcc/x86_64-unknown-linux-gnu/4.8.2/lto-wrapper
Target: x86_64-unknown-linux-gnu
Configured with: ../gcc/configure --prefix=/home/kaltsi/gcc48
--disable-bootstrap --with-tune=generic --disable-multilib
--enable-checking=release --with-system-zlib --enable-__cxa_atexit
--disable-libunwind-exceptions --enable-gnu-unique-object --enable-lto
--enable-linker-build-id --enable-languages=c,c++ --enable-threads=posix
--enable-shared --disable-libgcj
Thread model: posix
gcc version 4.8.2 20130920 (prerelease) (GCC) 

Compiling the following simple program with these options on an Ubuntu 12.04
causes a failure:

$ gcc -Wp,-D_FORTIFY_SOURCE=2 -O2 -D_GNU_SOURCE=1




-- foo.c --
#include 

extern ssize_t recvfrom(int s, void *buf, size_t len, int flags, struct
sockaddr *from, socklen_t *fromlen);

int main()
{
  int s, flags; void *buf; size_t len; struct sockaddr *from; socklen_t*
fromlen;
  return(recvfrom(s, buf, len, flags, from, fromlen));
}

-- foo.c --

~/gcc48/bin$ ./gcc -Wp,-D_FORTIFY_SOURCE=2 -O2 -D_GNU_SOURCE=1 foo.c
In file included from /usr/include/x86_64-linux-gnu/sys/socket.h:251:0,
 from foo.c:5:
foo.c: In function ‘main’:
/usr/include/x86_64-linux-gnu/bits/socket2.h:65:1: error: inlining failed in
call to always_inline ‘recvfrom’: mismatched arguments
 recvfrom (int __fd, void *__restrict __buf, size_t __n, int __flags,
 ^
foo.c:12:18: error: called from here
   return(recvfrom(s, buf, len, flags, from, fromlen));
  ^

[Bug c/33763] [4.6/4.7/4.8 Regression] Bogus inlining failed in call to `xxx': redefined extern inline functions are not considered for inlining

2013-09-20 Thread kaltsi+gnu at gmail dot com
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=33763

--- Comment #43 from Juha Kallioinen  ---
(In reply to Jakub Jelinek from comment #42)
> (In reply to Juha Kallioinen from comment #41)
> > Maybe this failure with a newly built gcc 4.8 is related to this bug.
> 
> No, that is just a buggy testcase.  Redefining a prototype, especially if
> you have no idea how the system function prototype looks like, is a bug.
> In the testcaseif you redefine the prototype to something different and
> obviously it then fails to inline it.  Don't do that.

This was just a reduction of a piece of code that started to fail with gcc 4.8,
but compiles with earlier versions. I'll try to understand what is different in
the prototype redefinition.