Conversation

GCC 14 is still in development, but it has a wonderful new feature in its static analyzer (-fanalyzer).

It can now draw beautiful Unicode diagrams showing exactly how you went out-of-bounds.

See https://inbox.sourceware.org/gcc-patches/20230531180630.3127108-1-dmalcolm@redhat.com/ too.

Thank you to the wonderful David Malcolm for implementing this - who also does a tonne of work with mentoring for GCC's GSoC programme, and working on docs to help new people get into GCC: https://gcc-newbies-guide.readthedocs.io/en/latest/index.html.

@gnutools

4
19
10

coolbean (account has been reverted to before we moved back to this instance)

1
0
2
not serious, this actually sounds pretty great
Show content

@thesamesam @gnutools

For all the people who still held any illusions that they are good at writing C:

"Look, human. This is where your weird human brain decided to introduce a fence-post error again.
Here, I have drawn you a picture. Sorry, crayons were out." blobcatgiggle

0
0
0
@thesamesam this is just too cool tbh

static analyzers are cool
0
0
1
GCC is the best compiler (I say as I use an OS entirely compiled with Clang & LLVM and therefore having a lot of symlinks to use GCC instead)
1
0
2

coolbean (account has been reverted to before we moved back to this instance)

@usernameswift oh god you must have so many fucking ports installed
0
0
0

@thesamesam @gnutools I won’t pretend to really understand this, but I just have to say:

IT LOOKS SO COOL. Plus, visualizing things can greatly help folks who process better visually, so I’m a huge fan!

0
0
0
@thesamesam Reminds me of it being a thing where clang prints a warning but which scan-build ignores…

$ scan-build clang /tmp/foo.c -o /tmp/foo
scan-build: Using '/usr/lib/llvm/16/bin/clang-16' for static analysis
/tmp/foo.c:5:20: warning: format specifies type 'char *' but the argument has type 'char' [-Wformat]
printf("bar: %s", foo[3]);
~~ ^~~~~~
%c
/tmp/foo.c:5:20: warning: array index 3 is past the end of the array (that has type 'char[2]') [-Warray-bounds]
printf("bar: %s", foo[3]);
^ ~
/tmp/foo.c:4:2: note: array 'foo' declared here
char foo[2] = "a";
^
2 warnings generated.
scan-build: Analysis run complete.
scan-build: Removing directory '/tmp/scan-build-2023-07-14-041437-3476-1' because it contains no reports.
scan-build: No bugs found.
0
0
0

I should also say that if you want a distribution that makes it very easy to have multiple GCCs installed at once and is recognised for its high-quality toolchain maintenance, you know where we are 😉

0
0
1