[Bug c/90081] stdint constant macros evaluating to wrong type

2019-04-18 Thread harald at gigawatt dot nl
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90081 --- Comment #10 from Harald van Dijk --- (In reply to jos...@codesourcery.com from comment #9) Thanks, appreciate the explanation. I guess I'm less willing to trust that the interpretation that makes sense is the one that's intended, but I can s

[Bug c/90081] stdint constant macros evaluating to wrong type

2019-04-18 Thread joseph at codesourcery dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90081 --- Comment #9 from joseph at codesourcery dot com --- On Thu, 18 Apr 2019, harald at gigawatt dot nl wrote: > > I think expanding the macro to its argument is clearly correct here, > > including for UINT8_C, as the interpretation suggested in

[Bug c/90081] stdint constant macros evaluating to wrong type

2019-04-18 Thread harald at gigawatt dot nl
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90081 --- Comment #8 from Harald van Dijk --- (In reply to jos...@codesourcery.com from comment #7) > No, INT8_C(5) must expand to have type int, not int_least8_t, if > int_least8_t promotes to int. See 7.20.4#3, "The type of the expression > shall

[Bug c/90081] stdint constant macros evaluating to wrong type

2019-04-18 Thread joseph at codesourcery dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90081 --- Comment #7 from joseph at codesourcery dot com --- On Sat, 13 Apr 2019, bafap5 at yahoo dot com wrote: > int x = sizeof ((int8_t) 5); /* Correct, gives 1 */ > int y = sizeof (INT8_C(5)); /* Incorrect, gives 4 */ No, INT8_C(5) must expa

[Bug c/90081] stdint constant macros evaluating to wrong type

2019-04-15 Thread harald at gigawatt dot nl
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90081 --- Comment #6 from Harald van Dijk --- (In reply to Guy Perfect from comment #5) > (In reply to Harald van Dijk from comment #4) > That was my line of thinking: supplying a cast in the macro. Keep in mind that inside #if expressions, there cann

[Bug c/90081] stdint constant macros evaluating to wrong type

2019-04-15 Thread bafap5 at yahoo dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90081 --- Comment #5 from Guy Perfect --- (In reply to Harald van Dijk from comment #4) That was my line of thinking: supplying a cast in the macro. Even in the case of negative values being cast to unsigned types, the language spec provides a rule for

[Bug c/90081] stdint constant macros evaluating to wrong type

2019-04-15 Thread harald at gigawatt dot nl
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90081 Harald van Dijk changed: What|Removed |Added CC||harald at gigawatt dot nl --- Comment

[Bug c/90081] stdint constant macros evaluating to wrong type

2019-04-13 Thread msebor at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90081 Martin Sebor changed: What|Removed |Added URL||http://www.open-std.org/jtc

[Bug c/90081] stdint constant macros evaluating to wrong type

2019-04-13 Thread bafap5 at yahoo dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90081 --- Comment #2 from Guy Perfect --- The issue is not resolved based on the merits of the out-of-range values used in the earlier examples. Type resolution still fails in the current implementation, as demonstrated below: int x = sizeof ((int8_

[Bug c/90081] stdint constant macros evaluating to wrong type

2019-04-13 Thread sch...@linux-m68k.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90081 Andreas Schwab changed: What|Removed |Added Status|UNCONFIRMED |RESOLVED Resolution|---