Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Build fails with gcc14: error: assignment to 'Objptr' {aka 'unsigned char *'} from 'int' makes pointer from integer without a cast [-Wint-conversion] #578

Open
barracuda156 opened this issue Aug 9, 2024 · 4 comments

Comments

@barracuda156
Copy link
Contributor

The first error is with an old MLton which is used for bootstrap, so we can only patch it locally. The second should be fixed here, perhaps:

          /opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_lang_mlton/mlton/work/.tmp/fileRpMQu9.o \
          /opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_lang_mlton/mlton/work/.tmp/fileEQaoED.363.c
In file included from /opt/local/libexec/mlton-bootstrap/lib/mlton/include/c-chunk.h:216,
                 from /opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_lang_mlton/mlton/work/.tmp/fileEQaoED.363.c:110:
/opt/local/libexec/mlton-bootstrap/lib/mlton/include/basis/coerce.h: In function 'Real32_castToWord32':
/opt/local/libexec/mlton-bootstrap/lib/mlton/include/basis/coerce.h:42:5: error: implicit declaration of function 'memcpy' [-Wimplicit-function-declaration]
   42 |     memcpy(&y, &x, sizeof(t));                  \
      |     ^~~~~~
/opt/local/libexec/mlton-bootstrap/lib/mlton/include/basis/coerce.h:46:1: note: in expansion of macro 'cast'
   46 | cast(Real32, Word32)
      | ^~~~
/opt/local/libexec/mlton-bootstrap/lib/mlton/include/basis/coerce.h:1:1: note: include '<string.h>' or provide a declaration of 'memcpy'
  +++ |+#include <string.h>
    1 | 
/opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_lang_mlton/mlton/work/.tmp/fileEQaoED.363.c: In function 'Chunk0':
/opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_lang_mlton/mlton/work/.tmp/fileEQaoED.363.c:27869:39: error: assignment to 'Objptr' {aka 'unsigned char *'} from 'int' makes pointer from integer without a cast [-Wint-conversion]
27869 |         O(Objptr, G(Objptr, 5277), 0) = 0x11;
      |                                       ^
/opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_lang_mlton/mlton/work/.tmp/fileEQaoED.363.c:27874:39: error: assignment to 'Objptr' {aka 'unsigned char *'} from 'int' makes pointer from integer without a cast [-Wint-conversion]
27874 |         O(Objptr, G(Objptr, 5278), 0) = 0x9;
      |                                       ^
/opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_lang_mlton/mlton/work/.tmp/fileEQaoED.363.c:27879:39: error: assignment to 'Objptr' {aka 'unsigned char *'} from 'int' makes pointer from integer without a cast [-Wint-conversion]
27879 |         O(Objptr, G(Objptr, 5279), 0) = 0x5;
      |                                       ^
/opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_lang_mlton/mlton/work/.tmp/fileEQaoED.363.c:31807:39: error: assignment to 'Objptr' {aka 'unsigned char *'} from 'int' makes pointer from integer without a cast [-Wint-conversion]
31807 |         O(Objptr, G(Objptr, 5990), 0) = 0x81;
      |                                       ^
/opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_lang_mlton/mlton/work/.tmp/fileEQaoED.363.c:31812:39: error: assignment to 'Objptr' {aka 'unsigned char *'} from 'int' makes pointer from integer without a cast [-Wint-conversion]
31812 |         O(Objptr, G(Objptr, 5991), 0) = 0x41;
      |                                       ^
/opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_lang_mlton/mlton/work/.tmp/fileEQaoED.363.c:31817:39: error: assignment to 'Objptr' {aka 'unsigned char *'} from 'int' makes pointer from integer without a cast [-Wint-conversion]
31817 |         O(Objptr, G(Objptr, 5992), 0) = 0x21;
      |                                       ^
   Compile and Assemble raised in 3.62 + 0.00 (0% GC)
MLton raised in 365.82 + 149.95 (29% GC)
@MatthewFluet
Copy link
Member

The former is certainly already fixed: 3edda85

I do not observe an error with a C codegen self-compile on Fedora 40 (gcc 14); looking at the generated C code, I see statements like:

O(Objptr, T(Q, 97), 0) = (Objptr)(Word64)(0x21ull);

so there seem to be sufficient casts. I'm not precisely sure when those casts were introduced; there was a fair amount of refactoring of the RSSA and Machine IRs prior to the 20210117 release (which also includes the commit linked above).

What version of MLton is being used for the bootstrap?

@barracuda156
Copy link
Contributor Author

@MatthewFluet The last version for ppc was 20070826, which is what we use: https://github.com/macports/macports-ports/blob/master/lang/mlton-bootstrap/Portfile

If a newer version is required, perhaps the only non-painful way would be if you could host my bootstrap binary (I can build it against 10.5 or possibly 10.4 target). And then I can update the port to pick a new version for bootstrapping mlton.

@MatthewFluet
Copy link
Member

@barracuda156 Sure, I suppose we could host a ppc build on sourceforge.

@barracuda156
Copy link
Contributor Author

@MatthewFluet Thank you! I will handle it in 2–3 days and update here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants