Bug 1323512 - xen build problems with -ftree-coalesce-vars with gcc6
Summary: xen build problems with -ftree-coalesce-vars with gcc6
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: Fedora
Classification: Fedora
Component: gcc
Version: 24
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: Jakub Jelinek
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2016-04-03 19:37 UTC by Michael Young
Modified: 2016-05-15 14:01 UTC (History)
6 users (show)

Fixed In Version: gcc-6.1.1-2.fc24
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2016-05-15 14:01:22 UTC
Type: Bug


Attachments (Terms of Use)
file with the compile issue (429.42 KB, text/plain)
2016-04-07 22:56 UTC, Michael Young
no flags Details


Links
System ID Private Priority Status Summary Last Updated
GNU Compiler Collection 70593 0 None None None 2016-04-08 08:36:12 UTC

Description Michael Young 2016-04-03 19:37:29 UTC
When I updated one of my installs to Fedora 24 I found that the xen hypervisor would no longer boot, but the hypervisor from the same code compiled under Fedora 23 would boot. I haven't traced where exactly the problem is, but I have narrowed it down to the tree-coalesce-vars option as if I add -fno-tree-coalesce-vars to the CFLAGS then the resulting hypervisor will boot again.

Comment 1 Jakub Jelinek 2016-04-03 20:04:38 UTC
Can you find out which object file is problematic (do a binary search between objects compiled with -O0 and normal option set (or -fno-tree-coalesce-vars and normal options))?
Then see if -fno-inline still reproduces it, or if inlining is needed for the problem reproduction?
Then one can use __attribute__((optimize (0))) on selected functions to find the problematic function.

Comment 2 Michael Young 2016-04-07 22:56:22 UTC
Created attachment 1144907 [details]
file with the compile issue

I traced the compile issue to the xen/arch/x86/usercopy.c in the xen-4.6.1 code, which shows the failure on the __copy_to_user_ and __copy_from_user_ll functions. I have attached the result of running cpp on the usercopy.c file.

Comment 3 Jakub Jelinek 2016-04-07 23:04:51 UTC
What gcc options are used to compile this file?

Comment 4 Michael Young 2016-04-07 23:18:22 UTC
When building xen the standard build line is
gcc -O2 -fomit-frame-pointer -m64 -fno-strict-aliasing -std=gnu99 -Wall -Wstrict-prototypes -Wdeclaration-after-statement -Wno-unused-but-set-variable -Wno-unused-local-typedefs   -DNDEBUG -I/home/michael/xen/xen-4.6.1/xen/include  -I/home/michael/xen/xen-4.6.1/xen/include/asm-x86/mach-generic -I/home/michael/xen/xen-4.6.1/xen/include/asm-x86/mach-default -msoft-float -fno-stack-protector -fno-exceptions -Wnested-externs -DHAVE_GAS_VMX -DHAVE_GAS_EPT -DHAVE_GAS_FSGSBASE -mno-red-zone -mno-sse -fpic -fno-asynchronous-unwind-tables -DGCC_HAS_VISIBILITY_ATTRIBUTE -fno-builtin -fno-common -Werror -Wredundant-decls -Wno-pointer-arith -pipe -g -D__XEN__ -include /home/michael/xen/xen-4.6.1/xen/include/xen/config.h -nostdinc -DCONFIG_SHADOW_PAGING -DHAS_ACPI -DHAS_GDBSX -DHAS_PASSTHROUGH -DHAS_MEM_ACCESS -DHAS_MEM_PAGING -DHAS_MEM_SHARING -DHAS_PCI -DHAS_IOPORTS -DHAS_PDX -MMD -MF .usercopy.o.d -c usercopy.c -o usercopy.o
which results in a xen hypervisor which crashes. The build with -fno-tree-coalesce-vars added after -O2 works.

Comment 5 Jakub Jelinek 2016-04-08 08:36:12 UTC
Thanks, tracking this upstream: PR70593

Comment 6 Michael Young 2016-05-15 14:01:22 UTC
Now gcc-6.1.1-2.fc24 has made the build repositories, I have tried building xen without adding -fno-tree-coalesce-vars and the resulting hypervisor boots successfully, so I consider this bug fixed.


Note You need to log in before you can comment on or make changes to this bug.