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

sequence-point warning with gcc -Wall #53

Closed
greghudson opened this issue Oct 9, 2020 · 1 comment
Closed

sequence-point warning with gcc -Wall #53

greghudson opened this issue Oct 9, 2020 · 1 comment

Comments

@greghudson
Copy link

Building with gcc version 7.5.0 or 9.3.0 and the -Wall flag, I see several warnings of the form:

aeskey.c: In function ‘aes_decrypt_key192’:
aeskey.c:407:34: warning: operation on ‘ss[4]’ may be undefined [-Wsequence-point]
     cx->ks[v(48,(4))] = ff(ss[4] = word_in(key, 4));
aesopt.h:363:25: note: in definition of macro ‘to_byte’
 #  define to_byte(x)  ((x) & 0xff)
                         ^
aesopt.h:737:12: note: in expansion of macro ‘bval’
   ^ tab[2][bval(vf(x,2,c),rf(2,c))] \
            ^~~~
aesopt.h:737:17: note: in expansion of macro ‘vf1’
   ^ tab[2][bval(vf(x,2,c),rf(2,c))] \
                 ^~
aesopt.h:759:29: note: in expansion of macro ‘four_tables’
 #  define inv_mcol(x)       four_tables(x,t_use(i,m),vf1,rf1,0)
                             ^~~~~~~~~~~
aeskey.c:242:17: note: in expansion of macro ‘inv_mcol’
 #define ff(x)   inv_mcol(x)
                 ^~~~~~~~
aeskey.c:407:25: note: in expansion of macro ‘ff’
     cx->ks[v(48,(4))] = ff(ss[4] = word_in(key, 4));
                         ^~

four_tables() uses its first argument four times, so using it with a side-effecting expression may be the source of the complaint.

@greghudson
Copy link
Author

Fixed by PR #55.

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

1 participant