Live data from Hacker News

GCC 10.1 Released

gcc.gnu.org

1–10 of 145 posts

Re: GCC 10.1 Released

#3

I love the built-in static analyzer -fanalyzer option in gcc-10. [1] https://gcc.gnu.org/onlinedocs/gcc/Static-Analyzer-Options.h...

What do you love the most about the new analyzer pass? I haven't had a chance to try it out for myself yet but I'm looking forward to it.

Re: GCC 10.1 Released

#5
post #3

I love the built-in static analyzer -fanalyzer option in gcc-10. [1] https://gcc.gnu.org/onlinedocs/gcc/Static-Analyzer-Options.h...

What do you love the most about the new analyzer pass? I haven't had a chance to try it out for myself yet but I'm looking forward to it.

An example to detect use-after-free: https://godbolt.org/z/zhiNLW

Basically this replicates what clang-tidy did

Re: GCC 10.1 Released

#8
> Several C++20 features have been implemented: > P0912R5, Coroutines (requires -fcoroutines)

Nice to see a bunch of C++20 features making it in. Coroutines seems like a big one!

Re: GCC 10.1 Released

#9
post #5
post #3

Earlier quoted context omitted.

What do you love the most about the new analyzer pass? I haven't had a chance to try it out for myself yet but I'm looking forward to it.

An example to detect use-after-free: https://godbolt.org/z/zhiNLW Basically this replicates what clang-tidy did

Too bad it doesn't detect the mismatch between new and free.

Re: GCC 10.1 Released

#10
post #7

I love the built-in static analyzer -fanalyzer option in gcc-10. [1] https://gcc.gnu.org/onlinedocs/gcc/Static-Analyzer-Options.h...

Imagine if -fanalyze was like rusts borrow checker

You Rust borrow checker requires special annotations and restrictions put on the code to do its job. I don't think you could something like that automatically on a C or C++ full codebase without having to manually annotate and refactor it somewhat. There are many common (and safe) C and C++ patterns that would be outright rejected by Rust's borrow checker, for instance initializing a structure or array partially if you're sure that nobody is going to use the initialized portion. Or having multiple mutable pointers/reference to the same object.

You could do something like that at runtime though, but then you have Valgrind, basically.

Post reply on HN