MPS issue job004113

TitleMPS does not compile with GCC 7.3
Statusclosed
Priorityessential
Assigned userGareth Rees
OrganizationRavenbrook
DescriptionIn the master sources at changelevel 195127:

    $ make -f xci6gc.gmk VARIETY=cool
           ...
    ss.c: In function 'StackScan':
    ss.c:49:9: error: variable 'warmest' might be clobbered by 'longjmp' or 'vfork' [-Werror=clobbered]
        void *warmest;
              ^~~~~~~
AnalysisWe don't actually call longjmp on this jump buffer, but there seems to be no way to tell that to GCC.

The POSIX specification for longjmp [1] says "the values of objects of automatic storage duration are unspecified if they meet all the following conditions: They are local to the function containing the corresponding setjmp() invocation; They do not have volatile-qualified type; They are changed between the setjmp() invocation and longjmp() call."

In this case "warmest" meets the three criteria. But we can make the variable volatile.
How foundmanual_test
Evidence[1] http://pubs.opengroup.org/onlinepubs/9699919799/functions/longjmp.html
Created byGareth Rees
Created on2018-09-23 20:23:42
Last modified byGareth Rees
Last modified on2019-10-10 15:18:36
History2018-09-23 GDR Created.

Fixes

Change Effect Date User Description
196419 closed 2019-10-10 15:18:03 Gareth Rees Avoid warning from gcc 5.4.0.
195136 closed 2018-09-23 20:31:52 Gareth Rees Move assignment so as to avoid "variable 'warmest' might be clobbered by 'longjmp'".