On 2019-11-16 08:26 -0600, Segher Boessenkool wrote: > On Sat, Nov 16, 2019 at 06:44:35AM -0500, Jeffrey Walton wrote: > > On Sat, Nov 16, 2019 at 6:25 AM Segher Boessenkool > > <segher@xxxxxxxxxxxxxxxxxxx> wrote: > > > On Fri, Nov 15, 2019 at 08:05:57PM -0500, Jeffrey Walton wrote: > > > > g++ -DNDEBUG -g2 -O3 -mcpu=power9 -maltivec -c > > > > ppc_power9.cpp > > > > > > You forgot -Wall -Wextra, or at the very least -Wall. It > > > probably will > > > help you find this problem., too. > > > > OK, thanks. > > > > I have a comprehensive test script that does things like -Wall > > -Wextra. It takes 4 to 6 hours to run. It is not suitable for > > Travis, > > though. > > You should have warnings enabled *always*. It does not take extra > time, > not measurable anyway. The point is that the compiler will tell you > about likely errors you made, right after you made them, so it is > easy > to correct then, and a huge time saver. And if the compiler think > that > something may be wrong, but it really all is perfectly fine, perhaps > the > code should be written in such a way that this is more clear. Regarding this, is it worth considering to make -Wall the default? Recently our team is training some freshmen to write programs in C/C++. They often make some bugs (invoking UB in some way) and puzzle themselves. But we noticed that 90% of their bugs can be diagnosed by simply adding -Wall. -- Xi Ruoyao <xry111@xxxxxxxxxxxxxxxx> School of Aerospace Science and Technology, Xidian University