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

cgen: remove ull, which will cause compile error? #20750

Merged
merged 1 commit into from
Feb 7, 2024

Conversation

kbkpbot
Copy link
Contributor

@kbkpbot kbkpbot commented Feb 7, 2024

make fresh_vc
make[1]: Entering directory '/home/runner/work/v/v'
rm -rf ./vc
git clone --filter=blob:none --quiet https://github.com/vlang/vc ./vc
make[1]: Leaving directory '/home/runner/work/v/v'
cd ./vc && git clean -xf && git pull --quiet
make fresh_tcc
make[1]: Entering directory '/home/runner/work/v/v'
rm -rf ./thirdparty/tcc
git clone --filter=blob:none --quiet --branch thirdparty-linux-amd64 https://github.com/vlang/tccbin ./thirdparty/tcc
make[2]: Entering directory '/home/runner/work/v/v'
make[2]: Leaving directory '/home/runner/work/v/v'
make[1]: Leaving directory '/home/runner/work/v/v'
cd ./thirdparty/tcc && git clean -xf && git pull --quiet
cc  -std=gnu99 -w -o v1.exe ./vc/v.c -lm -lpthread 
./v1.exe -no-parallel -o v2.exe  cmd/v
vlib/v/gen/c/cheaders.v:839:52: error: this hexadecimal number has unsuitable digit `u`
  837 | }
  838 | // the default secret parameters
  839 | static const uint64_t _wyp[4] = {0xa0761d6478bd642full, 0xe7037ed1a0b428dbull, 0x8ebc6af09c88c6e3ull, 0x589965cc75374cc3ull};
      |                                                    ^
  840 | 
  841 | // a useful 64bit-64bit mix function to produce deterministic pseudo random numbers that can pass BigCrush and PractRand
make: *** [GNUmakefile:114: all] Error 1
Error: Process completed with exit code 2.

@spytheman
Copy link
Member

What is the environment, where you experience this error?

@JalonSolov
Copy link
Contributor

If I'm reading this correctly...

ull is a C-ism, declaring the variable to be type unsigned long long.

0xa0761d6478bd642full should be replaced with u64(0xa0761d6478bd642f)

@kbkpbot
Copy link
Contributor Author

kbkpbot commented Feb 7, 2024

It is C code , embedded as string in a V file.

839 | static const uint64_t _wyp[4] = {0xa0761d6478bd642full, 0xe7037ed1a0b428dbull, 0x8ebc6af09c88c6e3ull, 0x589965cc75374cc3ull};

But I think it should remove the ull, I am not sure all compiler support this.

@JalonSolov
Copy link
Contributor

No, it's not supported in all C compilers, especially older ones. Or possibly 32-bit ones? It's hard to tell, without checking the specific version of docs for each compiler.

@spytheman
Copy link
Member

spytheman commented Feb 7, 2024

I think those CI failures are specific to the PR (#20726).
V compiles fine on master, with all of tcc, gcc and clang.

@spytheman
Copy link
Member

https://gcc.gnu.org/onlinedocs/gcc/Long-Long.html

ISO C99 and ISO C++11 support data types for integers that are at least 64 bits wide, and as an extension GCC supports them in C90 and C++98 modes. Simply write long long int for a signed integer, or unsigned long long int for an unsigned integer. To make an integer constant of type long long int, add the suffix ‘LL’ to the integer. To make an integer constant of type unsigned long long int, add the suffix ‘ULL’ to the integer.

@spytheman
Copy link
Member

spytheman commented Feb 7, 2024

I think that there is a bug in #20726 , due to which, after some bootstrapping stages, the V scanner then tries to parse those strings, that contain the literals, as V numbers, but they are not.

i.e. the error is a symptom of a deeper problem, not something to be fixed.

@spytheman
Copy link
Member

I'll merge this, since all the tests passed, and it has the potential to unblock #20726, or at least reveal more details for the problem that I suspect is there.

@spytheman spytheman merged commit 9297644 into vlang:master Feb 7, 2024
54 checks passed
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

Successfully merging this pull request may close these issues.

None yet

3 participants