[LLVMbugs] [Bug 23916] New: Clang doesn't like 'void inline'. Regression wrt. gcc

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Mon Jun 22 16:15:51 PDT 2015


            Bug ID: 23916
           Summary: Clang doesn't like 'void inline'. Regression wrt. gcc
           Product: clang
           Version: 3.6
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: Frontend
          Assignee: unassignedclangbugs at nondot.org
          Reporter: wkoszek at gmail.com
                CC: llvmbugs at cs.uiuc.edu
    Classification: Unclassified

Created attachment 14504
  --> https://llvm.org/bugs/attachment.cgi?id=14504&action=edit
Sample.c code mentioned in the bug case

Our codebase used 'void inline' variable, and it seems like Clang doesn't like

----------------------- sample.c ---------------------------------
#include <stdio.h>

#ifdef FIX
#define PREFIX static
#define PREFIX

struct stats {
    int pkt;
typedef struct stats stats_t;

PREFIX void inline
recv_stats(stats_t* stats, void *p)

    stats_t stats;
    recv_stats(&stats, 0);
vm:~/vr/accelerator% cc -v
Using built-in specs.
Target: x86_64-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Ubuntu 4.8.2-19ubuntu1'
--enable-languages=c,c++,java,go,d,fortran,objc,obj-c++ --prefix=/usr
--program-suffix=-4.8 --enable-shared --enable-linker-build-id
--libexecdir=/usr/lib --without-included-gettext --enable-threads=posix
--with-gxx-include-dir=/usr/include/c++/4.8 --libdir=/usr/lib --enable-nls
--with-sysroot=/ --enable-clocale=gnu --enable-libstdcxx-debug
--enable-libstdcxx-time=yes --enable-gnu-unique-object --disable-libmudflap
--enable-plugin --with-system-zlib --disable-browser-plugin
--enable-java-awt=gtk --enable-gtk-cairo
--with-java-home=/usr/lib/jvm/java-1.5.0-gcj-4.8-amd64/jre --enable-java-home
--with-arch-directory=amd64 --with-ecj-jar=/usr/share/java/eclipse-ecj.jar
--enable-objc-gc --enable-multiarch --disable-werror --with-arch-32=i686
--with-abi=m64 --with-multilib-list=m32,m64,mx32 --with-tune=generic
--enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu
Thread model: posix
gcc version 4.8.2 (Ubuntu 4.8.2-19ubuntu1)
vm:~/vr/accelerator% cc sample.c -o sample
vm:~/vr/accelerator% cc -DFIX sample.c -o sample.fix
vm:~/vr/accelerator% ls -la sample sample.fix
-rwxrwxr-x 1 wkoszek wkoszek 8497 Jun 22 16:10 sample
-rwxrwxr-x 1 wkoszek wkoszek 8497 Jun 22 16:10 sample.fix
vm:~/vr/accelerator% clang sample.c -o sample
/tmp/sample-b5c729.o: In function `main':
sample.c:(.text+0x17): undefined reference to `recv_stats'
clang: error: linker command failed with exit code 1 (use -v to see invocation)
vm:~/vr/accelerator% clang -DFIX sample.c -o sample

This leads to:

vm:~/vr/accelerator% cc -c -o sample-cc.o sample.c
vm:~/vr/accelerator% clang -c -o sample-clang.o sample.c
vm:~/vr/accelerator% nm sample-cc.o
000000000000001d T main
0000000000000000 T recv_stats
vm:~/vr/accelerator% nm sample-clang.o
0000000000000000 T main
                 U recv_stats


if a function is "void inline", GCC compiled the function OK and put it in the
.text section. Clang compiles the code OK, but puts the code in unknown

You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20150622/ae6b387e/attachment.html>

More information about the llvm-bugs mailing list