MPS issue job004037

TitleCompilation of apss.c fails with GCC 6.1
Statusclosed
Priorityessential
Assigned userGareth Rees
OrganizationRavenbrook
DescriptionBasile Starynkevitch writes [1]:

I just am trying to compile the latest MPS from git on a
Linux/Debian/Testing system (kernel is 4.6, GNU libc is 2.23, GCC
compiler is 6.1, processor is x86-64 Intel i5-4690S).

So I typed:

    git clone git@github.com:Ravenbrook/mps.git
    cd mps/code
    make -f lii6gc.gmk

And the build fails with

    apss.c: In function ‘stress’:
    apss.c:82:5: error: dereferencing type-punned pointer might break
    strict-aliasing rules [-Werror=strict-aliasing]
         res = make((mps_addr_t *)&ps[i], ap, ss[i]);
         ^~~
    apss.c:125:7: error: dereferencing type-punned pointer might break
    strict-aliasing rules [-Werror=strict-aliasing]
           res = make((mps_addr_t *)&ps[i], ap, ss[i]);
           ^~~
    cc1: all warnings being treated as errors
    comm.gmk:616: recipe for target 'lii6gc/hot/apss.o' failed
AnalysisGCC 6.1 is right and the code in apss.c is wrong -- we have a whole section in the manual about this error [2]. "p4 blame" shows that the code in apss.c has been like this since Pekka wrote it in 1999.

More seriously, it seems that we are not keeping up to date with GCC releases in our continuous integration.
How foundcustomer
Evidence[1] https://info.ravenbrook.com/mail/2016/08/24/17-36-53/0/
[2] http://www.ravenbrook.com/project/mps/.../html/topic/interface.html#type-punning
Created byGareth Rees
Created on2016-08-25 09:48:59
Last modified byGareth Rees
Last modified on2018-08-28 11:13:57
History2016-08-25 GDR Created.

Fixes

Change Effect Date User Description
192104 closed 2016-09-02 19:20:58 Gareth Rees Avoid strict aliasing errors in the MPS test suite, so that it compiles and runs using GCC 6.1.
Update the manual entries for mps_alloc and mps_sac_alloc with notes highlighting the problem.