Bug 995446
Summary: | gcc -02 optmization regression in v4.8 causing malformed arg passing (32 bit arch only) | ||||||||
---|---|---|---|---|---|---|---|---|---|
Product: | [Fedora] Fedora | Reporter: | Peter Rajnoha <prajnoha> | ||||||
Component: | gcc | Assignee: | Jakub Jelinek <jakub> | ||||||
Status: | CLOSED UPSTREAM | QA Contact: | Fedora Extras Quality Assurance <extras-qa> | ||||||
Severity: | urgent | Docs Contact: | |||||||
Priority: | high | ||||||||
Version: | 19 | CC: | agk, atu, jakub, law, masao-takahashi, mpatocka, mpolacek, yjcoshc, zkabelac | ||||||
Target Milestone: | --- | ||||||||
Target Release: | --- | ||||||||
Hardware: | i386 | ||||||||
OS: | Linux | ||||||||
Whiteboard: | |||||||||
Fixed In Version: | Doc Type: | Bug Fix | |||||||
Doc Text: | Story Points: | --- | |||||||
Clone Of: | |||||||||
: | 996643 (view as bug list) | Environment: | |||||||
Last Closed: | 2013-09-30 10:13:54 UTC | Type: | Bug | ||||||
Regression: | --- | Mount Type: | --- | ||||||
Documentation: | --- | CRM: | |||||||
Verified Versions: | Category: | --- | |||||||
oVirt Team: | --- | RHEL 7.3 requirements from Atomic Host: | |||||||
Cloudforms Team: | --- | Target Upstream Version: | |||||||
Embargoed: | |||||||||
Bug Depends On: | |||||||||
Bug Blocks: | 996643 | ||||||||
Attachments: |
|
Description
Peter Rajnoha
2013-08-09 11:42:15 UTC
(In reply to Peter Rajnoha from comment #0) > ?id=2f61478436a7ebe058ffad3f92e1c4dada0805d0. The workaround we provide for > now is that the _cfg_path variable is not define with "const" qualifier (so > we assume that the optimizer is less aggressive then - it actually helps). (sorry, I meant "static" qualifier, not the "const"). Also, shuffling the arg list for the _config_def_check_tree fn helped (but the workaround with removing the "static" is shorter... This is not reproducible with the older gcc v4.7.2 (the version that is currently in F18). Please provide preprocessed source for the source file in question and gcc command line options used to compile it. Created attachment 785648 [details]
preprocessed lib/config/config.c from lvm2 source tree
Preprocessed config.i attached, the complete option list used:
-Wall -Wundef -Wshadow -Wcast-align -Wwrite-strings -Wmissing-prototypes -Wmissing-declarations -Wnested-externs -Winline -Wmissing-noreturn -Wformat-security -Wredundant-decls -Wpointer-arith -g -O2 -fPIC -save-temps
I think I'd prefer to see this under debugger, how can one reproduce this under gdb and does it require any special setup? The expanded strlen of an aligned string should look like this: s_l: .LFB12: .cfi_startproc movl $b, %eax .L2: movl (%eax), %ecx addl $4, %eax leal -16843009(%ecx), %edx notl %ecx andl %ecx, %edx andl $-2139062144, %edx je .L2 movl %edx, %ecx shrl $16, %ecx testl $32896, %edx cmove %ecx, %edx leal 2(%eax), %ecx cmove %ecx, %eax addb %dl, %dl sbbl $3, %eax subl $b, %eax ret In the assembler that results from compiling the submitted file with "gcc -m32 -O2 -g -fPIC config.i -S" we can see: .L706: movl (%edx), %ecx addl $4, %edx leal -16843009(%ecx), %eax notl %ecx movl %eax, 44(%esp) andl %ecx, 44(%esp) andl $-2139062144, 44(%esp) je .L706 movl 44(%esp), %eax movl 52(%esp), %ecx movl %ecx, 60(%esp) movl %eax, %ecx shrl $16, %ecx testl $32896, %eax movl %ecx, 52(%esp) movl %eax, %ecx leal 2(%edx), %eax cmove 52(%esp), %ecx cmove %eax, %edx addb %cl, 44(%esp) .loc 1 775 0 movl 160(%esp), %eax .loc 1 776 0 sbbl $3, %edx subl 48(%esp), %edx .loc 1 775 0 addl 56(%esp), %edx movl %edx, %ecx --- that "addb %cl, 44(%esp)" seems to be wrong, it should be "addb %cl, %cl" Created attachment 786091 [details]
rh995446.i
Self-contained reduced executable testcase.
Seems to be PR57459. Fixed in 4.8.1-6 and later. |