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

Only builds with clang, fails to build with gcc #7

Open
xyproto opened this issue Jul 31, 2018 · 1 comment
Open

Only builds with clang, fails to build with gcc #7

xyproto opened this issue Jul 31, 2018 · 1 comment

Comments

@xyproto
Copy link
Contributor

xyproto commented Jul 31, 2018

When building with clang, it works:

$ CC=clang make
clang -O2 -std=gnu99 -Wall -Werror -Wmissing-prototypes -I/home/afr/clones/vmir -DVMIR_USE_TLSF -I/home/afr/clones/vmir/tlsf -g src/main.c src/vmir.c tlsf/tlsf.c  -lm -o vmir

But with gcc, I get errors:

cc -O2 -std=gnu99 -Wall -Werror -Wmissing-prototypes -I/home/afr/clones/vmir -DVMIR_USE_TLSF -I/home/afr/clones/vmir/tlsf -g src/main.c src/vmir.c tlsf/tlsf.c  -lm -o vmir
In file included from src/vmir.c:595:
src/vmir_vm.c: In function ‘vm_exec’:
src/vmir_vm.c:1635:7: error: ‘strncat’ accessing between 1 and 4294967295 bytes at offsets [0, 4294967295] and [0, 4294967295] may overlap 1 byte at offset [0, 8589934590] [-Werror=restrict]
       strncat(HOSTADDR(R32(1)), HOSTADDR(R32(2)), R32(3));
       ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
src/vmir_vm.c:1628:7: error: ‘strncpy’ accessing between 0 and 4294967295 bytes at offsets [0, 4294967295] and [0, 4294967295] may overlap up to 4294967295 bytes at offset 4294967294 [-Werror=restrict]
       strncpy(HOSTADDR(R32(1)), HOSTADDR(R32(2)), R32(3));
       ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
src/vmir_vm.c:1621:7: error: ‘strcat’ accessing 1 or more bytes at offsets [0, 4294967295] and [0, 4294967295] may overlap 1 byte at offset [0, 9223372036854775807] [-Werror=restrict]
       strcat(HOSTADDR(R32(1)), HOSTADDR(R32(2)));
       ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
src/vmir_vm.c:1614:7: error: ‘strcpy’ accessing 1 byte at offsets [0, 4294967295] and [0, 4294967295] may overlap 1 byte at offset 0 [-Werror=restrict]
       strcpy(HOSTADDR(R32(1)), HOSTADDR(R32(2)));
       ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
cc1: all warnings being treated as errors
make: *** [Makefile:29: vmir] Error 1

GCC version:

$ cc --version
cc (GCC) 8.1.1 20180531
Copyright (C) 2018 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

Clang version:

$ clang --version
clang version 6.0.1 (tags/RELEASE_601/final)
Target: x86_64-pc-linux-gnu
Thread model: posix
InstalledDir: /usr/bin

This is on 64-bit Arch Linux.

@morimolymoly
Copy link

Could you try to add -Wno-error=restrict CFLAGS in Makefile?

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