Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 510990 (PR61144) - [4.9/bad-code] gcc miscompiles sys-libs/musl
Summary: [4.9/bad-code] gcc miscompiles sys-libs/musl
Status: RESOLVED FIXED
Alias: PR61144
Product: Gentoo Linux
Classification: Unclassified
Component: [OLD] Core system (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Gentoo Toolchain Maintainers
URL: https://gcc.gnu.org/PR61144
Whiteboard:
Keywords:
Depends on:
Blocks: 915000
  Show dependency tree
 
Reported: 2014-05-22 02:45 UTC by Ryan Hill (RETIRED)
Modified: 2023-10-01 06:04 UTC (History)
3 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Ryan Hill (RETIRED) gentoo-dev 2014-05-22 02:45:52 UTC
4.9.0 miscompiles fflush (possibly other functions) in musl.

Testcase:
static int dummy = 0;
extern int foo __attribute__((__weak__, __alias__("dummy")));
int bar() { if (foo) return 1; return 0; }

dirtyepic@caribou ~/tmp $ gcc-4.8.2 -O2 -c pr61144.c -o pr61144
dirtyepic@caribou ~/tmp $ objdump -dr pr61144

pr61144:     file format elf64-x86-64


Disassembly of section .text:

0000000000000000 <bar>:
   0:	8b 15 00 00 00 00    	mov    0x0(%rip),%edx        # 6 <bar+0x6>
			2: R_X86_64_PC32	foo-0x4
   6:	31 c0                	xor    %eax,%eax
   8:	85 d2                	test   %edx,%edx
   a:	0f 95 c0             	setne  %al
   d:	c3                   	retq   
dirtyepic@caribou ~/tmp $ gcc-4.9.0 -O2 -c pr61144.c -o pr61144
dirtyepic@caribou ~/tmp $ objdump -dr pr61144

pr61144:     file format elf64-x86-64


Disassembly of section .text:

0000000000000000 <bar>:
   0:	31 c0                	xor    %eax,%eax
   2:	c3                   	retq  


I'll do a backport once a patch has been approved upstream.
Comment 1 SpanKY gentoo-dev 2014-11-01 06:48:50 UTC
fix is included in gcc-4.9.2