Bug ID 1110092
Summary clang 6.0.1 fails to correctly initialize structures and produces broken binaries!
Classification openSUSE
Product openSUSE Tumbleweed
Version Current
Hardware Other
OS Other
Status NEW
Severity Normal
Priority P5 - None
Component Basesystem
Assignee bnc-team-screening@forge.provo.novell.com
Reporter asn@cryptomilk.org
QA Contact qa-bugs@suse.de
Found By ---
Blocker ---

If I compile the socket_wrapper project [1] with clang and run the tests, they
started to fail.

My current WIP tree is at [2] for reproducing it.

For the tests, socker_wrapper implements a very simple echo server. If I run
this echo server with valgrind, I see:

==11833== Invalid write of size 8
==11833==    at 0x40211E: echo_udp (echo_srv.c:783)
==11833==    by 0x401CF4: echo (echo_srv.c:826)
==11833==    by 0x40164E: main (echo_srv.c:918)
==11833==  Address 0x1ffebff248 is on thread 1's stack
==11833==  in frame #0, created by echo_udp (echo_srv.c:782)
==11833== 
==11833== Invalid write of size 8
==11833==    at 0x4036F54: memset (in
/usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so)
==11833==    by 0x402122: echo_udp (echo_srv.c:783)
==11833==    by 0x401CF4: echo (echo_srv.c:826)
==11833==    by 0x40164E: main (echo_srv.c:918)
==11833==  Address 0x1ffefff310 is on thread 1's stack
==11833==  in frame #1, created by echo_udp (echo_srv.c:782)

Looking at the code, this is:

781 static void echo_udp(int sock)                                              
782 {
783     struct torture_address saddr = {                                        
784         .sa_socklen = sizeof(struct sockaddr_storage),                      
785     };


So it looks like, clang has a bug initializing structures!



[1] https://cwrap.org/socket_wrapper.html
[2] https://git.cryptomilk.org/users/asn/socket_wrapper.git/log/?h=master-fix


You are receiving this mail because: