Re: Code optimization: warning for code that hangs

2012-06-25 Thread Peter A. Felvegi
Hello, So far so good, but J::F() is strange: Dump of assembler code for function J::F(): 0x00400498 <+0>:subrsp,0x8 0x0040049c <+4>:movrax,QWORD PTR [rdi] 0x0040049f <+7>:movrax,QWORD PTR [rax] 0x004004a2 <+10>:movrax

Re: Code optimization: warning for code that hangs

2012-06-24 Thread David Brown
On 24/06/12 23:54, Robert Dewar wrote: On 6/24/2012 12:09 PM, Ángel González wrote: "Peter A. Felvegi" writes: My question is: wouldn't it be possible to print a warning when a jmp to itself or trivial infinite recursion is generated? The code compiled fine w/ -Wall -Wextra -Werror w/ 4.6 and 4

Re: Code optimization: warning for code that hangs

2012-06-24 Thread Robert Dewar
On 6/24/2012 12:09 PM, Ángel González wrote: "Peter A. Felvegi" writes: My question is: wouldn't it be possible to print a warning when a jmp to itself or trivial infinite recursion is generated? The code compiled fine w/ -Wall -Wextra -Werror w/ 4.6 and 4.7. Note that if the target architectur

Re: Code optimization: warning for code that hangs

2012-06-24 Thread Robert Dewar
On 6/24/2012 11:22 AM, Richard Guenther wrote: I suppose I think it would be reasonable to issue a -Wall warning for code like that. The trick is detecting it. Obviously there is nothing wrong with a recursive call. What is different here is that the recursive call is unconditional. I don't

Re: Code optimization: warning for code that hangs

2012-06-24 Thread Ángel González
"Peter A. Felvegi" writes: >>> My question is: wouldn't it be possible to print a warning when a jmp >>> to itself or trivial infinite recursion is generated? The code >>> compiled fine w/ -Wall -Wextra -Werror w/ 4.6 and 4.7. Note that if the target architecture is a microcontroller, an endless lo

Re: Code optimization: warning for code that hangs

2012-06-24 Thread Richard Guenther
On Sat, Jun 23, 2012 at 5:30 PM, Ian Lance Taylor wrote: > "Peter A. Felvegi" writes: > >> My question is: wouldn't it be possible to print a warning when a jmp >> to itself or trivial infinite recursion is generated? The code >> compiled fine w/ -Wall -Wextra -Werror w/ 4.6 and 4.7. > > This que

Re: Code optimization: warning for code that hangs

2012-06-23 Thread Ian Lance Taylor
"Peter A. Felvegi" writes: > My question is: wouldn't it be possible to print a warning when a jmp > to itself or trivial infinite recursion is generated? The code > compiled fine w/ -Wall -Wextra -Werror w/ 4.6 and 4.7. This question is not appropriate for the mailing list gcc@gcc.gnu.org, whic

Code optimization: warning for code that hangs

2012-06-23 Thread Peter A. Felvegi
Hello, I bumped into a strange bug today: the program hang at a point, inspecting the disassembly revealed that it was a single jmp instruction which jumped onto itself. Most of the code from the C++ function was missing. The bug occurs at -O2 or -O3, -O1 generates correct code. The function