Note: This is a public test instance of Red Hat Bugzilla. The data contained within is a snapshot of the live data so any changes you make will not be reflected in the production Bugzilla. Email is disabled so feel free to test any aspect of the site that you want. File any problems you find or give feedback at bugzilla.redhat.com.
Bug 1861276 - LTO breaks tpm2-pkcs11 build
Summary: LTO breaks tpm2-pkcs11 build
Keywords:
Status: NEW
Alias: None
Product: Fedora
Classification: Fedora
Component: gcc
Version: 33
Hardware: s390x
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: Jeff Law
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks: ZedoraTracker 1789115
TreeView+ depends on / blocked
 
Reported: 2020-07-28 08:15 UTC by Dan Horák
Modified: 2020-10-05 08:11 UTC (History)
11 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed:
Type: Bug
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
GNU Compiler Collection 96397 0 P3 UNCONFIRMED GCC Fails to exploit ranges from overflow tests 2020-08-27 14:51:26 UTC

Description Dan Horák 2020-07-28 08:15:50 UTC
With LTO enabled tpm2-pkcs11 build fails with

...
+ make check
make   test/unit/test_twist test/unit/test_log test/unit/test_parser test/unit/test_attr 
make[1]: Entering directory '/builddir/build/BUILD/tpm2-pkcs11-1.3.1'
  CC       test/unit/test_unit_test_twist-test_twist.o
  CCLD     test/unit/test_twist
In function 'memcpy',
    inlined from 'internal_append' at src/lib/twist.c:114:10,
    inlined from 'twistbin_append' at src/lib/twist.c:302:9,
    inlined from 'twistbin_append' at src/lib/twist.c:290:7,
    inlined from 'test_twistbin_new_overflow_3' at test/unit/test_twist.c:264:17:
/usr/include/bits/string_fortified.h:34:10: error: '__builtin_memcpy' specified bound 18446744073709551603 exceeds maximum object size 9223372036854775807 [-Werror=stringop-overflow=]
   34 |   return __builtin___memcpy_chk (__dest, __src, __len, __bos0 (__dest));
      |          ^
In function 'memset',
    inlined from 'twist_truncate' at src/lib/twist.c:346:3,
    inlined from 'test_twist_truncate_smaller' at test/unit/test_twist.c:825:17:
/usr/include/bits/string_fortified.h:71:10: error: '__builtin_memset' specified bound 18446744073709551612 exceeds maximum object size 9223372036854775807 [-Werror=stringop-overflow=]
   71 |   return __builtin___memset_chk (__dest, __ch, __len, __bos0 (__dest));
      |          ^
lto1: all warnings being treated as errors
lto-wrapper: fatal error: gcc returned 1 exit status
compilation terminated.
/usr/bin/ld: error: lto-wrapper failed
collect2: error: ld returned 1 exit status


Please see https://koji.fedoraproject.org/koji/taskinfo?taskID=47999421 for full logs.


Version-Release number of selected component (if applicable):
tpm2-pkcs11-1.3.1-1.fc33
gcc-10.2.1-1.fc33.s390x

Comment 1 Jeff Law 2020-07-29 19:04:41 UTC
All kinds of interesting possibilities here, I'm sure the unique inlining tuning on s390 comes into play.  Thanks for passing it along.

Comment 2 Jeff Law 2020-07-31 04:35:43 UTC
So this is a combination of LTO's cross-module inlining combined with a missed optimization computing ranges for integer overflow tests which results in an infeasible path being left in the CFG.  On that infeasible path we have propagated a negative constant value into the size argument of a memset call and we get the bogus diagnostic.

I've filed an upstream BZ for the missed optimization.  There's actually a good chance this will be solvable with work that Andrew & Aldy are looking to land in gcc-11.

In the immediate term, I think the s390 disablement of LTO is quite reasonable.

Comment 3 Ben Cotton 2020-08-11 13:50:05 UTC
This bug appears to have been reported against 'rawhide' during the Fedora 33 development cycle.
Changing version to 33.


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