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

3.0.3 Compilation problems #18346

Closed
WyzHyl opened this issue May 19, 2022 · 6 comments
Closed

3.0.3 Compilation problems #18346

WyzHyl opened this issue May 19, 2022 · 6 comments
Labels
resolved: answered The issue contained a question which has been answered resolved: not a bug The issue is not considered a bug

Comments

@WyzHyl
Copy link

WyzHyl commented May 19, 2022

crypto/bn/bn_dh.c:34:5: error: initializer element is not constant
crypto/bn/bn_dh.c:34:5: error: (near initialization for 'modp_1536_p[0]')

Error when compiling 3.0.3, 1.X version does not have this problem,The compiler used is the ARM cross compiler

@WyzHyl WyzHyl added the issue: question The issue was opened to ask a question label May 19, 2022
@paulidale paulidale added branch: master Merge to master branch triaged: bug The issue/pr is/fixes a bug branch: 3.0 Merge to openssl-3.0 branch and removed issue: question The issue was opened to ask a question labels May 19, 2022
@paulidale
Copy link
Contributor

ca2bf55 is the culprit commit.

@t8m
Copy link
Member

t8m commented May 19, 2022

Except this is a clear bug of the compiler - the initializer is a constant expression.

@paulidale
Copy link
Contributor

I've seen a few (ancient) compilers didn't like constant expressions.

The C89 standard says it is allowed in 6.5.7 but doesn't admit it in foot note 54 in 6.4 which defines constant expressions. It doesn't appear to mandate that constant expressions are evaluated at compiler time (they can be).

C99 mandates that they are evaluated at compile time.

@paulidale paulidale added resolved: not a bug The issue is not considered a bug resolved: answered The issue contained a question which has been answered and removed branch: master Merge to master branch triaged: bug The issue/pr is/fixes a bug branch: 3.0 Merge to openssl-3.0 branch labels May 19, 2022
@paulidale
Copy link
Contributor

I think the answer to the original question is your compiler is at fault.

@WyzHyl
Copy link
Author

WyzHyl commented May 19, 2022

I think the reason is that the compiler I'm using doesn't recognize this form of initialization
static const BN_ULONG modp_1536_p[] = {
BN_DEF(0xFFFFFFFF, 0xFFFFFFFF), BN_DEF(0xCA237327, 0xF1746C08),

@t8m
Copy link
Member

t8m commented May 19, 2022

Yes, and that's a serious deficiency of the compiler as it is just a preprocessor macro expanding to a simple constant expression (BN_ULONG)0xF1746C08 << 32 | 0xCA237327

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
resolved: answered The issue contained a question which has been answered resolved: not a bug The issue is not considered a bug
Projects
None yet
Development

No branches or pull requests

3 participants