Package: gcc-5 Version: 5.3.1-5 Severity: normal During debugging for some strange behaviour in DRBD I got upon this.
* DRBD 8.4 from GIT head (http://git.drbd.org/drbd-8.4.git/) * compiling for linux-headers-4.3.0-1-amd64=4.3.3-5 * drbd_send_dblock(), in drbd/drbd_main.c For reference: the codeblock is around line 1759, and looks like this: if (dp_flags & DP_DISCARD) { struct p_trim *t = (struct p_trim*)p; t->size = cpu_to_be32(req->i.size); err = __send_command(peer_device->connection, device->vnr, sock, P_TRIM, sizeof(*t), NULL, 0); goto out; } if (dp_flags & DP_WSAME) { Now, when I look at the generated disassembly, the "goto out" instruction is simply missing: 0x0000000000028626 <+358>: mov %eax,0x18(%rdi) 0x0000000000028629 <+361>: mov 0x10(%rsp),%rax 0x000000000002862e <+366>: mov 0x18(%r10),%rdi 0x0000000000028632 <+370>: mov 0x68(%rax),%esi 0x0000000000028635 <+373>: movl $0x0,0x8(%rsp) 0x000000000002863d <+381>: movq $0x0,(%rsp) 0x0000000000028645 <+389>: callq 0x267d0 <__send_command> 0x000000000002864a <+394>: mov %eax,0x20(%rsp) # store result 0x000000000002864e <+398>: mov 0x40(%rsp),%rdi # load for DP_WSAME 0x0000000000028653 <+403>: callq 0x28658 <drbd_send_dblock+408> When I insert #pragma GCC push_options #pragma GCC optimize ("O0") above the function definition, the result is this: 0x0000000000027aad <+605>: movl $0x0,0x8(%rsp) 0x0000000000027ab5 <+613>: movq $0x0,(%rsp) 0x0000000000027abd <+621>: mov $0x1c,%r9d 0x0000000000027ac3 <+627>: mov $0x31,%r8d 0x0000000000027ac9 <+633>: mov %rax,%rdi 0x0000000000027acc <+636>: callq 0x2cc00 <__send_command> 0x0000000000027ad1 <+641>: mov %eax,0x30(%rsp) 0x0000000000027ad5 <+645>: jmpq 0x27de0 <drbd_send_dblock+1424> 0x0000000000027ada <+650>: mov 0x2c(%rsp),%eax Hooray, the jump is back! -- System Information: Debian Release: stretch/sid APT prefers testing APT policy: (990, 'testing'), (500, 'unstable'), (500, 'stable'), (1, 'experimental') Architecture: amd64 (x86_64) Kernel: Linux 4.3.0-1-amd64 (SMP w/4 CPU cores) Locale: LANG=de_AT.UTF-8, LC_CTYPE=de_AT.UTF-8 (charmap=UTF-8) Shell: /bin/sh linked to /bin/dash Init: systemd (via /run/systemd/system) Versions of packages gcc-5 depends on: ii binutils 2.25.90.20160101-1 ii cpp-5 5.3.1-5 ii gcc-5-base 5.3.1-5 ii libc6 2.21-6 ii libcc1-0 5.3.1-5 ii libgcc-5-dev 5.3.1-5 ii libgcc1 1:5.3.1-5 ii libgmp10 2:6.1.0+dfsg-2 ii libisl15 0.15-3 ii libmpc3 1.0.3-1 ii libmpfr4 3.1.3-2 ii libstdc++6 5.3.1-5 ii zlib1g 1:1.2.8.dfsg-2+b1 Versions of packages gcc-5 recommends: ii libc6-dev 2.21-6 Versions of packages gcc-5 suggests: pn gcc-5-doc <none> pn gcc-5-locales <none> pn gcc-5-multilib <none> pn libasan2-dbg <none> pn libatomic1-dbg <none> pn libcilkrts5-dbg <none> pn libgcc1-dbg <none> pn libgomp1-dbg <none> pn libitm1-dbg <none> pn liblsan0-dbg <none> pn libmpx0-dbg <none> pn libquadmath0-dbg <none> pn libtsan0-dbg <none> pn libubsan0-dbg <none> -- no debconf information