[Bug sanitizer/90347] New: [UBSAN] __attribute__((weak))__ results in "declared weak after being used" error
dimhen at gmail dot com
gcc-bugzilla@gcc.gnu.org
Sat May 4 18:37:00 GMT 2019
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90347
Bug ID: 90347
Summary: [UBSAN] __attribute__((weak))__ results in "declared
weak after being used" error
Product: gcc
Version: 10.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: sanitizer
Assignee: unassigned at gcc dot gnu.org
Reporter: dimhen at gmail dot com
CC: dodji at gcc dot gnu.org, dvyukov at gcc dot gnu.org,
jakub at gcc dot gnu.org, kcc at gcc dot gnu.org, marxin at gcc dot gnu.org
Target Milestone: ---
$ cat x.cpp
struct s { };
extern s var;
// __attribute__ ((weak)) s var; // no error
extern void foo(s&);
void bar()
{
foo(var);
}
__attribute__ ((weak)) s var; // error
$ /usr/local/gcc_current/bin/g++ -fsanitize=undefined -Wall -c x.cpp
x.cpp:2:10: error: 'var' declared weak after being used
2 | extern s var;
| ^~~
$ /usr/local/gcc_current/bin/g++ -Wall -c x.cpp
$ $ /usr/local/gcc_current/bin/g++ -v
Using built-in specs.
COLLECT_GCC=/usr/local/gcc_current/bin/g++
COLLECT_LTO_WRAPPER=/usr/local/gcc_current/libexec/gcc/x86_64-pc-linux-gnu/10.0.0/lto-wrapper
OFFLOAD_TARGET_NAMES=nvptx-none
Target: x86_64-pc-linux-gnu
Configured with: /home/dimhen/src/gcc_current/configure
--prefix=/usr/local/gcc_current --enable-checking=yes,df,fold,rtl,extra
--enable-languages=c,c++,lto --disable-multilib --enable-shared
--enable-threads=posix --enable-__cxa_atexit --enable-gnu-unique-object
--enable-linker-build-id --with-linker-hash-style=gnu --enable-plugin
--enable-initfini-array --with-isl --enable-offload-targets=nvptx-none
--without-cuda-driver --enable-gnu-indirect-function --with-tune=native
Thread model: posix
gcc version 10.0.0 20190503 (experimental) [trunk revision 270859] (GCC)
More information about the Gcc-bugs
mailing list