Mail Archives: djgpp/1993/05/07/13:57:41
Peter E. Miller <PMILLER AT dpc2 DOT hdos DOT hac DOT COM> writes:
>> 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, ...
>> ...
>> When I changed this conditional branches into if/else if/else way, then gcc
>> did hang. I.e.
>> ...
>> didn't hang the gcc.
>
>I took both pieces of code and made the two source files at the end
>of this note. I used
> gcc -Wall -S test#.c
>on both. During compilation of test1.c a spurious character
>appeared at the top of my screen. Compilation of test2.c doesn't do
>this.
>
>When I used
> gcc -Wall -O -S test#.c
>a spurious character appeared on my screen during compilation of both,
>at the same location. These tests are repeatable for me.
>
>I have been using DJGPP 1.09 (2.2.2) ever since it was released and
>never noticed a problem like this. I've used it on a 386-16 ISA and a
>486-50 EISA without problems.
>
>---- test1.c --------------------------------------------------------
>#include <float.h>
>#include <math.h>
>
>double
>test (double x, double y)
>{
> if (y == 0.) return (23.6);
> if (x == 0.) return (DBL_MAX);
> return (10.*log10(y / x));
>}
>---- test2.c --------------------------------------------------------
>#include <float.h>
>#include <math.h>
>
>double
>test (double x, double y)
>{
> double p;
>
> if (y == 0.)
> p = 23.6;
> else if (x == 0.)
> p = DBL_MAX;
> else
> p = 10.*log10(y/x);
> return(p);
>}
>---------------------------------------------------------------------
These two test programs are short and good enough to produce the problem
occurred on my system as I posted before. On your machine, gcc behaves
differently, but on my machine, test1.c always makes the gcc hang, but test2.c
is okay without optimazation but gcc hangs with -O option. The results ware the
same with or without -S option.
I didn't expect this short code could reproduce the same problem!
(So far, only 2 systems(you and I) reported the problem.)
Thanks.
Wonkoo.
- Raw text -