Bug 1593144 - gcc: Stack realignment prologue clobbers %edi for fastcall functions with global register variable
Summary: gcc: Stack realignment prologue clobbers %edi for fastcall functions with glo...
Keywords:
Status: CLOSED EOL
Alias: None
Product: Fedora
Classification: Fedora
Component: gcc
Version: 29
Hardware: i686
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: Jakub Jelinek
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks: 1593246
TreeView+ depends on / blocked
 
Reported: 2018-06-20 07:52 UTC by Remi Collet
Modified: 2019-11-27 22:48 UTC (History)
18 users (show)

Fixed In Version:
Clone Of:
: 1593246 (view as bug list)
Environment:
Last Closed: 2019-11-27 22:48:07 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
GNU Compiler Collection 86236 0 None None None 2019-08-01 20:16:28 UTC

Description Remi Collet 2018-06-20 07:52:27 UTC
Trying to build PHP in rawhide in a segfault during the build (in some PHP command run)

https://koji.fedoraproject.org/koji/taskinfo?taskID=27745701

According to Koschei
https://apps.fedoraproject.org/koschei/package/php

this could be related to glibc update from 2.27.9000-22.fc29  to 2.27.9000-25.fc29

F28 build is ok.
https://koji.fedoraproject.org/koji/taskinfo?taskID=27745817

there is no change since 7.2.7RC1 which build ok.


Backtrace doesn't seems really useful:
(gdb) bt
#0  ZEND_UNSET_DIM_SPEC_CV_CONST_HANDLER () at /builddir/build/BUILD/php-7.2.7/Zend/zend_vm_execute.h:37870
#1  0x5682ca0b in execute_ex () at /builddir/build/BUILD/php-7.2.7/Zend/zend_vm_execute.h:62305
#2  0x56832808 in zend_execute (op_array=<optimized out>, return_value=<optimized out>) at /builddir/build/BUILD/php-7.2.7/Zend/zend_vm_execute.h:63760
#3  0x567878ad in zend_execute_scripts () at /builddir/build/BUILD/php-7.2.7/Zend/zend.c:1496
#4  0x56722744 in php_execute_script () at /builddir/build/BUILD/php-7.2.7/main/main.c:2590
#5  0x56834f85 in do_cli (argc=13, argv=0x569ce4f0) at /builddir/build/BUILD/php-7.2.7/sapi/cli/php_cli.c:1011
#6  0x565d9f29 in main (argc=<optimized out>, argv=<optimized out>) at /builddir/build/BUILD/php-7.2.7/sapi/cli/php_cli.c:1404


Any help on this issue is very welcome.

Comment 2 Florian Weimer 2018-06-20 09:31:33 UTC
It's not the glibc update.  It's triggered by the build flag changes in redhat-rpm-config-113-1.fc29.  If I back that out locally by editing /usr/lib/rpm/redhat/rpmrc, the build gets much further.  It looks like just dropping -mstackrealign is sufficient.  Therefore, this is probably a GCC bug.

I will try to narrow down which object gets miscompiled.

Comment 3 Florian Weimer 2018-06-20 11:18:40 UTC
The affected object file is Zend/zend_execute.o.

I made a guess at what's wrong and filed the bug upstream.

Comment 4 Florian Weimer 2018-06-21 12:53:55 UTC
Since a combination of fastcall, global register variables, and -mstackrealign triggers this, I ran some benchmarks.

Disabling the global register variables has a huge impact on performance, so this is not a viable fix for PHP.  If the GCC bug can't be fixed for real (although we could use %eax in the DRAP prologue and %ecx in the DRAP epilogue, I assume), then we'd have to drop -mstackrealign from the PHP build purely for performance reasons.

Curiously, with -mstackrealign disabled, there is some slight regression in the mandel and mandel2 benchmarks when SSE2 is enabled.  SSE2 is supposed to be faster, but perhaps the i386 calling convention simply penalizes SSE2 usage too much (all those FPU—memory—SSE2 transfers probably aren't cheap taken together).

Comment 5 Remi Collet 2018-06-22 06:37:20 UTC
For memory, -mstackrealign temporarily removed from PHP build option
https://src.fedoraproject.org/cgit/rpms/php.git/commit/?id=d73b5b97d2e4baa54fa2642fef4dc427aa11d765

Comment 6 Harald Reindl 2018-07-29 21:18:36 UTC Comment hidden (abuse)
Comment 7 Harald Reindl 2018-07-29 21:59:22 UTC Comment hidden (abuse)
Comment 8 Jan Kurik 2018-08-14 09:57:17 UTC
This bug appears to have been reported against 'rawhide' during the Fedora 29 development cycle.
Changing version to '29'.

Comment 9 Ben Cotton 2019-10-31 19:09:39 UTC
This message is a reminder that Fedora 29 is nearing its end of life.
Fedora will stop maintaining and issuing updates for Fedora 29 on 2019-11-26.
It is Fedora's policy to close all bug reports from releases that are no longer
maintained. At that time this bug will be closed as EOL if it remains open with a
Fedora 'version' of '29'.

Package Maintainer: If you wish for this bug to remain open because you
plan to fix it in a currently maintained version, simply change the 'version' 
to a later Fedora version.

Thank you for reporting this issue and we are sorry that we were not 
able to fix it before Fedora 29 is end of life. If you would still like 
to see this bug fixed and are able to reproduce it against a later version 
of Fedora, you are encouraged  change the 'version' to a later Fedora 
version prior this bug is closed as described in the policy above.

Although we aim to fix as many bugs as possible during every release's 
lifetime, sometimes those efforts are overtaken by events. Often a 
more recent Fedora release includes newer upstream software that fixes 
bugs or makes them obsolete.

Comment 10 Ben Cotton 2019-11-27 22:48:07 UTC
Fedora 29 changed to end-of-life (EOL) status on 2019-11-26. Fedora 29 is
no longer maintained, which means that it will not receive any further
security or bug fix updates. As a result we are closing this bug.

If you can reproduce this bug against a currently maintained version of
Fedora please feel free to reopen this bug against that version. If you
are unable to reopen this bug, please file a new report against the
current release. If you experience problems, please add a comment to this
bug.

Thank you for reporting this bug and we are sorry it could not be fixed.


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