Bug 1420440

Summary: libbson-1.5.3-1.fc26 FTBFS: tests fail with GCC 7
Product: [Fedora] Fedora Reporter: Petr Pisar <ppisar>
Component: libbsonAssignee: Petr Pisar <ppisar>
Status: CLOSED RAWHIDE QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: rawhideCC: fedora, ppisar
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
URL: https://jira.mongodb.org/browse/CDRIVER-2010
Whiteboard:
Fixed In Version: libbson-1.5.3-2.fc26 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2017-02-09 11:19:51 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:

Description Petr Pisar 2017-02-08 16:22:27 UTC
libbson-1.5.3-1.fc26 fails to build in F26 because tests crash with SIGABORT. This is cause by upgrading gcc from 6.3.1-2.fc26 to 7.0.1-0.2.fc26 and it is caused by out-optimized signed integer wrap:

    { "status": "PASS", "test_file": "/bson/append_int32", "seed": "2751394709", "start": 26100.175135173, "end": 26101.052242048, "elapsed": 0.877106875 },
src/bson/bson-timegm.c:644:7: runtime error: signed integer overflow: 4611686018427387904 * 2 cannot be represented in type 'long int'
    { "status": "PASS", "test_file": "/bson/iso8601/utc", "seed": "1303037762", "start": 26100.226295036, "end": 26101.076501063, "elapsed": 0.850206027 },

    /*
    ** Do a binary search (this works whatever time_t's type is).
    */
    if (!TYPE_SIGNED(time_t)) {
        lo = 0;
        hi = lo - 1;
    } else {
        lo = 1;
        for (i = 0; i < (int) TYPE_BIT(time_t) - 1; ++i)
→           lo *= 2;
        hi = -(lo + 1);
    }