delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1993/05/05/21:58:37

Date: Wed, 5 May 1993 21:27 EST
From: "Wonkoo Kim, EE, U. of Pittsburgh" <WKIM AT vms DOT cis DOT pitt DOT edu>
Subject: gcc hangs: again
To: djgpp AT sun DOT soe DOT clarkson DOT EDU

I posted a problem that gcc is stucked when compiling a certain program.
In verifying the program, I found a new fact.  My file contains several 
functions and a function has several return() statements at the end of the 
function, like the following:
	if (y == 0) return (some constant);
	if (x == 0) return (DBL_MAX);
	return (10.*log10(y / x));

When I changed this conditional branches into if/else if/else way, then gcc did 
hang.  I.e.
	if (y == 0) 
		p = some constant;
	else if (x == 0)
		p = DBL_MAX;
	else
		p = 10.*log10(y/x);
	return(p);
didn't hang the gcc.

The previous code cannot be a wrong code, so gcc seems to have a bug.
(The above program was working with Borland C and Turbo C and I was converting 
it to djgpp/gcc.)
gcc seems to be hanged when it sees several return() statements and it couldn't 
determine which return() statement is the actual return point from the 
function.

Thanks.

Wonkoo.

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019