Skip to main content
13 events
when toggle format what by license comment
Jun 11, 2024 at 1:58 vote accept Madagascar
Jun 8, 2024 at 5:57 comment added Jonathan Leffler That's a distinct possibility — and it would appear that GCC 14.1.0 has greatly improved over GCC 13.2.0 (13.1.0). I've not yet built GCC 13.3.0 (released on 2024-05-21), so I don't know whether the improvements are present there, yet.
Jun 8, 2024 at 5:55 comment added Madagascar The only meaningful warnings I find are the ones you got from GCC 14.1. The ones from GCC 13.1/13.2 do not make any sense to me. To analyze the first warnings you got from GCC 13.2, "conversion from ‘long int’ to ‘int’" make no sense because the case _Generic picked was int, which means that the type of a was an int. Adding 0 to an int can not make it a long int, nor would an int overflow if 0 is added to it. Perhaps Lundin is right to say that -Wconversion has a lot of false positives and is not very useful.
Jun 8, 2024 at 5:37 comment added Jonathan Leffler With GCC 13.2.0 I got 18 errors from attempting to compile what I called test-max.c, compared with 12 from attempting to compile test-min.c. Things change. I also got 36 "note" lines from each compilation, so 2 per error on average for test-max.c vs 3 per error for test-min.c. And I agree that most of the options are not going to detect problems with the code, and -Wconversion is the primary … is 'culprit' the right word?
Jun 8, 2024 at 5:33 comment added Madagascar For max_test.c, GCC 13.1 with the flags you mentioned emitted around 100 or so warnings, with 3 notes for each.... Though somewhat less for min_test.c. I removed -Wconversion and they all dissapeared. I will look at them and fix them all. Thank you.
Jun 8, 2024 at 5:26 comment added Madagascar For max_test.c, GCC 13.1 with the flags you mentioned emitted around 100 or so warnings, with 3 notes for each.... Though somewhat less for min_test.c. I will look at them and fix them all. Thank you.
Jun 8, 2024 at 5:22 comment added Jonathan Leffler I added most of those flags and GCC 14.1.0 was still happy with the code. I used: gcc -o test-min -O3 -std=c23 -Wall -Wextra -Warray-bounds -Wconversion -Wformat-signedness -Wmissing-braces -Wno-parentheses -Wpedantic -Wstrict-prototypes -Wwrite-strings -Winline -fno-builtin -fno-common -fno-omit-frame-pointer -fsanitize=float-cast-overflow -fsanitize=address -fsanitize=undefined -fsanitize=leak test-min.c
Jun 8, 2024 at 5:09 comment added Madagascar I have added the compiler flags, as well as the Clang version in my question.
Jun 8, 2024 at 5:09 comment added Jonathan Leffler You should probably document the compiler flags you're using in the question. I suspect you are not using -Weverything -Werror (which is sane, because -Weverything is too harsh; you have to set various -Wno-… options too to get rid of blatantly irrelevant issues (-Wno-poison-system-directories, for example).
Jun 8, 2024 at 5:07 comment added Jonathan Leffler Would testing with Clang version 15.0.0 (clang-1500.3.9.4) on macOS help? AFAICT, that's pretty much the latest version — at least until WWDC next week. I'll have to copy the code from the Linux box (which doesn't have Clang installed), but that's not a major pain (unlike dealing with all the contortions in "simple" code to calculate minimum/maximum values).
Jun 8, 2024 at 5:02 history edited Jonathan Leffler CC BY-SA 4.0
Note that there are 12 errors.
Jun 8, 2024 at 5:00 comment added Madagascar I thought GCC might be hallucinating, as Clang wasn't complaining. Looks like I am in a deep mess. Thank you for your time. The code for MAX() is as it was, apologies if irked thee. :)
Jun 8, 2024 at 4:58 history answered Jonathan Leffler CC BY-SA 4.0