[Bug c++/85471] closing a "thread" in "C++" using "pthread_exit(NULL)" creates a "SIGABRT"

2018-06-16 Thread aotto1...@t-online.de
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85471

--- Comment #4 from Andreas Otto  ---
change my C++ wrapper from "embedded data" (large amount of data) to just an
embedded pointer (only 8byte pointer in the C++ class)

→ the error is still there…

==57730== Process terminating with default action of signal 6 (SIGABRT)
==57730==at 0x6BA2F67: raise (raise.c:55)
==57730==by 0x6BA4339: abort (abort.c:78)
==57730==by 0x4178DD: _Unwind_SetGR (unwind-dw2.c:273)
==57730==by 0x409B8C: __gxx_personality_v0 (eh_personality.cc:712)
==57730==by 0x72AC4A4: _Unwind_ForcedUnwind_Phase2 (unwind.inc:175)
==57730==by 0x72ACA64: _Unwind_ForcedUnwind (unwind.inc:207)
==57730==by 0x696098F: __pthread_unwind (unwind.c:126)
==57730==by 0x695A8B4: __do_cancel (pthreadP.h:283)
==57730==by 0x695A8B4: pthread_exit (pthread_exit.c:28)
==57730==by 0x506554E: libmsgque::SysExit(int, int) (sys.cc:1000)
==57730==by 0x5059987: libmsgque::MqSysExit(int, int) (msgque.h:2038)
==57730==by 0x505B4F8: libmsgque::MqExitP(libmsgque::MqS*, char const*,
char const*) (msgque.cc:440)
==57730==by 0x50B2FAA: ccmsgque::MqC::ExitP(char const*, char const*)
(MqC.cc:380)
==57730==by 0x405EF7: Filter6::EXIT() (Filter6.cc:80)
==57730==by 0x5099A15: ccmsgque::MqC::ProcCall(libmsgque::MqS*, void*)
(ccmisc.cc:50)
==57730==by 0x5043DA3: libmsgque::MqCallbackCall(libmsgque::MqS*,
libmsgque::MqCallbackS) (msgque_private.h:326)
==57730==by 0x5045368: libmsgque::pTokenInvoke(libmsgque::pTokenS const*)
(token.cc:342)
==57730==by 0x507836C: libmsgque::pServiceStart(libmsgque::MqS*,
libmsgque::MqErrorE (*)(void*, libmsgque::MqS**, libmsgque::MqEnvS*), void*)
(service.cc:244)
==57730==by 0x502D33B: libmsgque::pEventStart(libmsgque::MqS*,
libmsgque::MqEventS*, timeval const*) (event.cc:287)
==57730==by 0x5055AD3: libmsgque::pIoSelectStart(libmsgque::MqIoS*, timeval
const*) (io.cc:267)
==57730==by 0x5078B3E: libmsgque::MqProcessEvent(libmsgque::MqS*, long,
libmsgque::MqWaitOnEventE) (service.cc:377)
==57730==by 0x5063F70:
libmsgque::MqSysServerThreadMain(libmsgque::MqSysServerThreadMainS*)
(sys.cc:488)
==57730==by 0x5063FB7: libmsgque::sSysServerThreadInit(void*) (sys.cc:502)
==57730==by 0x6959723: start_thread (pthread_create.c:457)
==57730==by 0x6C5AE8C: clone (clone.S:109)
==57730== 
==57730== HEAP SUMMARY:
==57730== in use at exit: 160,370 bytes in 184 blocks
==57730==   total heap usage: 940 allocs, 756 frees, 677,695 bytes allocated
==57730== 
==57922== 
==57922== HEAP SUMMARY:
==57922== in use at exit: 72,944 bytes in 4 blocks
==57922==   total heap usage: 487 allocs, 483 frees, 273,097 bytes allocated
==57922== 
==57922== LEAK SUMMARY:
==57922==definitely lost: 0 bytes in 0 blocks
==57922==indirectly lost: 0 bytes in 0 blocks
==57922==  possibly lost: 0 bytes in 0 blocks
==57922==still reachable: 72,944 bytes in 4 blocks
==57922== suppressed: 0 bytes in 0 blocks
==57922== Rerun with --leak-check=full to see details of leaked memory
==57922== 
==57922== For counts of detected and suppressed errors, rerun with: -v
==57922== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 0 from 0)
==57730== LEAK SUMMARY:


but I have additional "leakcheck" data…


 trans2-3-TE2-init-(3|binary|uds|cc.uds.thread) start
==67406== 672 bytes in 2 blocks are possibly lost in loss record 131 of 151
==67406==at 0x4C2C240: calloc (in
/usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so)
==67406==by 0x40119E1: allocate_dtv (dl-tls.c:322)
==67406==by 0x401223D: _dl_allocate_tls (dl-tls.c:539)
==67406==by 0x695A180: allocate_stack (allocatestack.c:580)
==67406==by 0x695A180: pthread_create@@GLIBC_2.2.5 (pthread_create.c:654)
==67406==by 0x5064231: libmsgque::SysServerThread(libmsgque::MqS*,
libmsgque::MqFactoryS*, libmsgque::MqBufferLS**, libmsgque::MqBufferLS**, char
const*, int, libmsgque::MqIdS*) (sys.cc:562)
==67406==by 0x5057E6F: libmsgque::pIoStartServer(libmsgque::MqIoS*,
libmsgque::IoStartServerE, libmsgque::MqSockS*, libmsgque::MqIdS*) (io.cc:692)
==67406==by 0x5053294: libmsgque::GenericServer(libmsgque::GenericS*,
sockaddr*, unsigned int) (generic_io.cc:155)
==67406==by 0x5048FE9: libmsgque::UdsServer(libmsgque::UdsS*)
(uds_io.cc:129)
==67406==by 0x505421E: libmsgque::pIoCreate(libmsgque::MqS*,
libmsgque::MqIoS**) (io.cc:95)
==67406==by 0x5083507: libmsgque::MqLinkCreate(libmsgque::MqS*,
libmsgque::MqBufferLS*) (link.cc:1104)
==67406==by 0x5084730: libmsgque::MqLinkDefault(libmsgque::MqS*,
libmsgque::MqBufferLS*) (link.cc:1256)
==67406==by 0x5082279: libmsgque::MqLinkCreate(libmsgque::MqS*,
libmsgque::MqBufferLS*) (link.cc:971)
==67406==by 0x50B3ACD: ccmsgque::MqC::LinkCreate(ccmsgque::MqBufferLC*)
(MqC.cc:414)
==67406==by 0x5095DE2: ccmsgque::MqC::LinkCreate(ccmsgque::MqBufferLC)
(ccmsgque.cc:151)
==67406==by 0x40498B: main (Filter6.cc:176)
==67406==

[Bug c++/85471] closing a "thread" in "C++" using "pthread_exit(NULL)" creates a "SIGABRT"

2018-04-19 Thread aotto1...@t-online.de
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85471

--- Comment #2 from Andreas Otto <aotto1...@t-online.de> ---
this is not as easy because this is a non trivial SW… what I mean… to just use
my test-case you have to setup a whole environment… the basic of a SW is a
client/server application using a non trivial protocol…

it is possible you send me a hint to create a better error output for you… for
me it would be perfect if the GCC part of the error could be MORE specific
about the real reason of the SIGABRT

thanks for your work.

[Bug c++/85471] New: closing a "thread" in "C++" using "pthread_exit(NULL)" creates a "SIGABRT"

2018-04-19 Thread aotto1...@t-online.de
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85471

Bug ID: 85471
   Summary: closing a "thread" in "C++" using "pthread_exit(NULL)"
creates a "SIGABRT"
   Product: gcc
   Version: 7.3.1
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c++
  Assignee: unassigned at gcc dot gnu.org
  Reporter: aotto1...@t-online.de
  Target Milestone: ---
  Host: openSUSE 42.3 (x86_64)
Target: openSUSE 42.3 (x86_64)
 Build: openSUSE 42.3 (x86_64)

the c++ compiler I use:

g++-7 (SUSE Linux) 7.3.1 20180307 [gcc-7-branch revision 258314]
Copyright (C) 2017 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.


Problem
===

In one of my TEST-Cases… written for my own server-software… I close a
(worker)-thread using the following code…

> pthread_exit(NULL);

in "C" this works fine… in "c++" I get the error from below… covered with
"valgrind"…

question: why I get this error in "system" code 

==55315==
==55315== Process terminating with default action of signal 6 (SIGABRT)
==55315==at 0x58E7F67: raise (raise.c:55)
==55315==by 0x58E9339: abort (abort.c:78)
==55315==by 0x413FED: _Unwind_SetGR (unwind-dw2.c:273)
==55315==by 0x40763C: __gxx_personality_v0 (eh_personality.cc:712)
==55315==by 0x5FF04A4: _Unwind_ForcedUnwind_Phase2 (unwind.inc:175)
==55315==by 0x5FF0A64: _Unwind_ForcedUnwind (unwind.inc:207)
==55315==by 0x56A598F: __pthread_unwind (unwind.c:126)
==55315==by 0x569F8B4: __do_cancel (pthreadP.h:283)
==55315==by 0x569F8B4: pthread_exit (pthread_exit.c:28)
==55315==by 0x4E6AB00: libmsgque::SysExit(int, int) (sys.cc:935)
==55315==by 0x4E64E8C: libmsgque::MqSysExit(int, int) (msgque.h:5671)
==55315==by 0x4E65B05: libmsgque::MqExitP(libmsgque::MqS*, char const*,
char const*) (msgque.cc:417)
==55315==by 0x404917: ccmsgque::MqC::Exit() (ccmsgque.h:409)
==55315==
==55315== HEAP SUMMARY:
==55315== in use at exit: 101,380 bytes in 63 blocks
==55315==   total heap usage: 401 allocs, 338 frees, 493,733 bytes allocated
==55315==
==55315== LEAK SUMMARY:
==55315==definitely lost: 0 bytes in 0 blocks
==55315==indirectly lost: 0 bytes in 0 blocks
==55315==  possibly lost: 320 bytes in 1 blocks
==55315==still reachable: 101,060 bytes in 62 blocks
==55315== suppressed: 0 bytes in 0 blocks
==55315== Rerun with --leak-check=full to see details of leaked memory
==55315==
==55315== For counts of detected and suppressed errors, rerun with: -v
==55315== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 0 from 0)
Abgebrochen (Speicherabzug geschrieben)

[Bug target/84172] option "-O3" create slower code

2018-02-01 Thread aotto1...@t-online.de
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=84172

--- Comment #9 from Andreas Otto <aotto1...@t-online.de> ---
after morning "boot" it seems OK… BUT the bug come back

→ star without "-g" option

#:~/test> make test
for t in test.0 test.1 test.2 test.3; do ./$t; done
./test.0 → T1 = 663.640015 ms → HI = 0x1, LO = 0
./test.0 → T2 = 490.407990 ms → HI = 0x1, LO = 0
./test.1 → T1 = 137.326996 ms → HI = 0x1, LO = 0
./test.1 → T2 = 133.870010 ms → HI = 0x1, LO = 0
./test.2 → T1 = 138.035995 ms → HI = 0x1, LO = 0
./test.2 → T2 = 135.183014 ms → HI = 0x1, LO = 0
./test.3 → T1 = 137.481003 ms → HI = 0x1, LO = 0
./test.3 → T2 = 134.893997 ms → HI = 0x1, LO = 0
#:~/test> make test
for t in test.0 test.1 test.2 test.3; do ./$t; done
./test.0 → T1 = 656.669983 ms → HI = 0x1, LO = 0
./test.0 → T2 = 490.566986 ms → HI = 0x1, LO = 0
./test.1 → T1 = 134.537994 ms → HI = 0x1, LO = 0
./test.1 → T2 = 132.356003 ms → HI = 0x1, LO = 0
./test.2 → T1 = 144.015991 ms → HI = 0x1, LO = 0
./test.2 → T2 = 134.715012 ms → HI = 0x1, LO = 0
./test.3 → T1 = 137.255997 ms → HI = 0x1, LO = 0
./test.3 → T2 = 134.914001 ms → HI = 0x1, LO = 0

add "-g" option again

#:~/test> make test
gcc-5 -march=native -mtune=native -g -static -O0 -o test.0 main.c
gcc-5 -march=native -mtune=native -g -static -O1 -o test.1 main.c
gcc-5 -march=native -mtune=native -g -static -O2 -o test.2 main.c
gcc-5 -march=native -mtune=native -g -static -O3 -o test.3 main.c
for t in test.0 test.1 test.2 test.3; do ./$t; done
./test.0 → T1 = 655.403992 ms → HI = 0x1, LO = 0
./test.0 → T2 = 490.989014 ms → HI = 0x1, LO = 0
./test.1 → T1 = 132.431000 ms → HI = 0x1, LO = 0
./test.1 → T2 = 133.049988 ms → HI = 0x1, LO = 0
./test.2 → T1 = 141.020004 ms → HI = 0x1, LO = 0
./test.2 → T2 = 135.460999 ms → HI = 0x1, LO = 0
./test.3 → T1 = 211.210999 ms → HI = 0x1, LO = 0
./test.3 → T2 = 225.455002 ms → HI = 0x1, LO = 0
#:~/test> make test
for t in test.0 test.1 test.2 test.3; do ./$t; done
./test.0 → T1 = 662.700989 ms → HI = 0x1, LO = 0
./test.0 → T2 = 490.704010 ms → HI = 0x1, LO = 0
./test.1 → T1 = 146.843994 ms → HI = 0x1, LO = 0
./test.1 → T2 = 133.729996 ms → HI = 0x1, LO = 0
./test.2 → T1 = 140.351990 ms → HI = 0x1, LO = 0
./test.2 → T2 = 134.825012 ms → HI = 0x1, LO = 0
./test.3 → T1 = 213.688995 ms → HI = 0x1, LO = 0
./test.3 → T2 = 225.066010 ms → HI = 0x1, LO = 0

disable "-g" option

#:~/test> make test
gcc-5 -march=native -mtune=native -static -O0 -o test.0 main.c 
gcc-5 -march=native -mtune=native -static -O1 -o test.1 main.c 
gcc-5 -march=native -mtune=native -static -O2 -o test.2 main.c 
gcc-5 -march=native -mtune=native -static -O3 -o test.3 main.c 
for t in test.0 test.1 test.2 test.3; do ./$t; done
./test.0 → T1 = 652.817017 ms → HI = 0x1, LO = 0
./test.0 → T2 = 490.574005 ms → HI = 0x1, LO = 0
./test.1 → T1 = 139.962006 ms → HI = 0x1, LO = 0
./test.1 → T2 = 134.207001 ms → HI = 0x1, LO = 0
./test.2 → T1 = 134.936005 ms → HI = 0x1, LO = 0
./test.2 → T2 = 135.485001 ms → HI = 0x1, LO = 0
./test.3 → T1 = 217.895004 ms → HI = 0x1, LO = 0
./test.3 → T2 = 224.744003 ms → HI = 0x1, LO = 0
#:~/test> make test
for t in test.0 test.1 test.2 test.3; do ./$t; done
./test.0 → T1 = 660.490967 ms → HI = 0x1, LO = 0
./test.0 → T2 = 490.671997 ms → HI = 0x1, LO = 0
./test.1 → T1 = 141.137009 ms → HI = 0x1, LO = 0
./test.1 → T2 = 133.236008 ms → HI = 0x1, LO = 0
./test.2 → T1 = 136.444000 ms → HI = 0x1, LO = 0
./test.2 → T2 = 135.473999 ms → HI = 0x1, LO = 0
./test.3 → T1 = 256.563019 ms → HI = 0x1, LO = 0
./test.3 → T2 = 225.742996 ms → HI = 0x1, LO = 0

do som additional testing

#:~/test> rm test.
test.0  test.1  test.2  test.3  
#:~/test> rm test.*
#:~/test> make test
gcc-5 -march=native -mtune=native -static -O0 -o test.0 main.c 
gcc-5 -march=native -mtune=native -static -O1 -o test.1 main.c 
gcc-5 -march=native -mtune=native -static -O2 -o test.2 main.c 
gcc-5 -march=native -mtune=native -static -O3 -o test.3 main.c 
for t in test.0 test.1 test.2 test.3; do ./$t; done
./test.0 → T1 = 652.343994 ms → HI = 0x1, LO = 0
./test.0 → T2 = 490.720978 ms → HI = 0x1, LO = 0
./test.1 → T1 = 132.760010 ms → HI = 0x1, LO = 0
./test.1 → T2 = 132.718994 ms → HI = 0x1, LO = 0
./test.2 → T1 = 135.055008 ms → HI = 0x1, LO = 0
./test.2 → T2 = 135.212997 ms → HI = 0x1, LO 

[Bug target/84172] option "-O3" create slower code

2018-02-01 Thread aotto1...@t-online.de
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=84172

--- Comment #7 from Andreas Otto <aotto1...@t-online.de> ---
Created attachment 43321
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=43321=edit
cat /proc/cpuinfo

[Bug target/84172] option "-O3" create slower code

2018-02-01 Thread aotto1...@t-online.de
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=84172

--- Comment #5 from Andreas Otto <aotto1...@t-online.de> ---
Created attachment 43320
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=43320=edit
output of command you requested…

gcc-5 -march=native -mtune=native -g -static -O3 -o test.3 main.c -v

[Bug target/84172] option "-O3" create slower code

2018-02-01 Thread aotto1...@t-online.de
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=84172

--- Comment #3 from Andreas Otto <aotto1...@t-online.de> ---
send me the command that I should run…

[Bug c/84172] option "-O3" create slower code

2018-02-01 Thread aotto1...@t-online.de
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=84172

--- Comment #1 from Andreas Otto <aotto1...@t-online.de> ---
forget last "}"

[Bug c/84172] New: option "-O3" create slower code

2018-02-01 Thread aotto1...@t-online.de
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=84172

Bug ID: 84172
   Summary: option "-O3" create slower code
   Product: gcc
   Version: 5.3.1
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c
  Assignee: unassigned at gcc dot gnu.org
  Reporter: aotto1...@t-online.de
  Target Milestone: ---

here my test…

#:~/test> make test
gcc-5 -march=native -mtune=native -g -static -O0 -o test.0 main.c 
gcc-5 -march=native -mtune=native -g -static -O1 -o test.1 main.c 
gcc-5 -march=native -mtune=native -g -static -O2 -o test.2 main.c 
gcc-5 -march=native -mtune=native -g -static -O3 -o test.3 main.c 
for t in test.0 test.1 test.2 test.3; do ./$t; done
./test.0 → T1 = 673.300964 ms → HI = 0x1, LO = 0
./test.0 → T2 = 506.130981 ms → HI = 0x1, LO = 0
./test.1 → T1 = 136.671005 ms → HI = 0x1, LO = 0
./test.1 → T2 = 139.194000 ms → HI = 0x1, LO = 0
./test.2 → T1 = 139.225998 ms → HI = 0x1, LO = 0
./test.2 → T2 = 139.294998 ms → HI = 0x1, LO = 0
./test.3 → T1 = 217.908997 ms → HI = 0x1, LO = 0
./test.3 → T2 = 231.663010 ms → HI = 0x1, LO = 0

#:~/test> gcc-5 -v
Using built-in specs.
COLLECT_GCC=/usr/bin/gcc-5
COLLECT_LTO_WRAPPER=/usr/lib64/gcc/x86_64-suse-linux/5/lto-wrapper
Target: x86_64-suse-linux
Configured with: ../configure --prefix=/usr --infodir=/usr/share/info
--mandir=/usr/share/man --libdir=/usr/lib64 --libexecdir=/usr/lib64
--enable-languages=c,c++,fortran,ada,go --enable-checking=release
--with-gxx-include-dir=/usr/include/c++/5 --enable-ssp --disable-libssp
--disable-libvtv --enable-libmpx --disable-plugin
--with-bugurl=http://bugs.opensuse.org/ --with-pkgversion='SUSE Linux'
--disable-libgcj --with-slibdir=/lib64 --with-system-zlib --enable-__cxa_atexit
--enable-libstdcxx-allocator=new --disable-libstdcxx-pch
--with-default-libstdcxx-abi=gcc4-compatible
--enable-version-specific-runtime-libs --enable-linker-build-id
--enable-linux-futex --program-suffix=-5 --without-system-libunwind
--enable-multilib --with-arch-32=x86-64 --with-tune=generic
--build=x86_64-suse-linux --host=x86_64-suse-linux
Thread model: posix
gcc version 5.3.1 20160301 [gcc-5-branch revision 233849] (SUSE Linux) 
dev1usr@linux02:~/test> Selected  "main.c:40 [main]"

#my code

==
#include 
#include 
#include 
#include 

#define SIZE1

#if __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__
#   define  HI  1
#   define  LO  0
#else
#   define  HI  0
#   define  LO  1
#endif

int main(int argc, char *argv[])
{
int i;
clock_t t1, t2;

// T1
if (1) {
uint64_ta = 0x;
uint64_tb = 0xfffe;
unsigned __int128   r;
t1 = clock();

for (i=0; i<SIZE; i++) {
r = ((unsigned __int128) a * (unsigned __int128) b);
if (i%2==0) {
a += (uint64_t) (r>>64);
b -= (uint64_t) (r>>0);
} else {
a -= (uint64_t) (r>>64);
b += (uint64_t) (r>>0);
}
}

t2 = clock();
float diff = ((float)(t2 - t1) / (float)CLOCKS_PER_SEC ) * 1000;
printf("%-20s → T1 = %f ms → HI = %#x, LO = %#x\n", argv[0], diff, a,
b);
}

// T2
if (1) {
typedef union valU {
unsigned __int128   ui128;
uint64_tui64[2]  ;
} valU_t;

uint64_ta = 0x;
uint64_tb = 0xfffe;
valU_t  r;

t1 = clock();

for (i=0; i<SIZE; i++) {
r.ui128 = ((unsigned __int128) a * (unsigned __int128) b);
if (i%2==0) {
a += r.ui64[HI];
b -= r.ui64[LO];
} else {
a -= r.ui64[HI];
b += r.ui64[LO];
}
}

t2 = clock();
float diff = ((float)(t2 - t1) / (float)CLOCKS_PER_SEC ) * 1000;
printf("%-20s → T2 = %f ms → HI = %#x, LO = %#x\n", argv[0], diff, a,
b);
}

exit(0);
===