public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/30981]  New: Program "Hangs"
@ 2007-02-27 13:26 ray at ultramarine dot com
  2007-02-27 17:07 ` [Bug fortran/30981] " burnus at gcc dot gnu dot org
                   ` (15 more replies)
  0 siblings, 16 replies; 17+ messages in thread
From: ray at ultramarine dot com @ 2007-02-27 13:26 UTC (permalink / raw)
  To: gcc-bugs

If a has a value of +Infinity, then a program will "hang" (run forever) when

    b = x**a      
is executed.

The traceback shows that this occurs in the library routine pow_r4_i4

 uname -a
 ========

 Linux devlop 2.6.16.13-4-smp #1 SMP Wed May 3 04:53:23 UTC 2006 x86_64 x86_64
x86_64 GNU/Linux

gfortran -v   
=======

 Using built-in specs.
Target: x86_64-unknown-linux-gnu
Configured with: /e_source/gcc-4.1.1/configure --prefix=/add/linux64/gcc4.1.1
 Thread model: posix
 gcc version 4.1.1


-- 
           Summary: Program "Hangs"
           Product: gcc
           Version: 4.1.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: ray at ultramarine dot com


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=30981


^ permalink raw reply	[flat|nested] 17+ messages in thread

* [Bug fortran/30981] Program "Hangs"
  2007-02-27 13:26 [Bug fortran/30981] New: Program "Hangs" ray at ultramarine dot com
@ 2007-02-27 17:07 ` burnus at gcc dot gnu dot org
  2007-02-27 18:01 ` ray at ultramarine dot com
                   ` (14 subsequent siblings)
  15 siblings, 0 replies; 17+ messages in thread
From: burnus at gcc dot gnu dot org @ 2007-02-27 17:07 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from burnus at gcc dot gnu dot org  2007-02-27 17:07 -------
Could you post an example?

pow_r4_i4 means that you have x**a = <real(4)>**<integer(4)>

I don't see how the exponent "a" can be infinity if it is an integer(4).

And the following program executes in <4 ms with gfortran 4.3.0 20070227 and
4.1.3 20070218 (prerelease) (SUSE Linux).

You might want to try an newer GCC (4.1.2 or 4.2 or 4.3).
Nightly builds of the latter two are available from:
http://gcc.gnu.org/wiki/GFortranBinaries#GNU/Linux


-- 

burnus at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |burnus at gcc dot gnu dot
                   |                            |org


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=30981


^ permalink raw reply	[flat|nested] 17+ messages in thread

* [Bug fortran/30981] Program "Hangs"
  2007-02-27 13:26 [Bug fortran/30981] New: Program "Hangs" ray at ultramarine dot com
  2007-02-27 17:07 ` [Bug fortran/30981] " burnus at gcc dot gnu dot org
@ 2007-02-27 18:01 ` ray at ultramarine dot com
  2007-02-27 19:35 ` [Bug fortran/30981] a ** exp fails for integer exponents if exp is "-huge()-1" (endless loop) burnus at gcc dot gnu dot org
                   ` (13 subsequent siblings)
  15 siblings, 0 replies; 17+ messages in thread
From: ray at ultramarine dot com @ 2007-02-27 18:01 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #2 from ray at ultramarine dot com  2007-02-27 18:00 -------
Subject: Re:  Program "Hangs"


On Tue, 27 Feb 2007, burnus at gcc dot gnu dot org wrote:

> 
> 
> ------- Comment #1 from burnus at gcc dot gnu dot org  2007-02-27 17:07 -------
> Could you post an example?
> 
> pow_r4_i4 means that you have x**a = <real(4)>**<integer(4)>
> 
> I don't see how the exponent "a" can be infinity if it is an integer(4).
> 
      subroutine num_normalize(sigfig,number,   n_normal,exponent)
c
c@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
c@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
c@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
c
c     ---------------     num_normalize     ---------------
c
c                                             Copyright Ultramarine,inc.
c                                             August 1997
c
c.D
c.D NAME=num_normalize
c.D      Routine to crack NUMBER to characters in ARRAY
c.D OUTPUT
c.D      ARRAY               = Character array of NUMBER
c.D      NPLACE              = Integer*4 Number of Characters used
c.D                            if NPLACE < 0 then could not convert
c.D
c
c@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
c@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
c@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
c
c
c
c*********************************************      no implicit
c
      implicit none
c
c*********************************************      externals
c
c
c*********************************************      global variables
c
      include '$(where)/amos/include/essential.ecm'
c
c*********************************************      local variables
c
      TYPE_INTEGER exponent,sigfig,pow
      TYPE_REAL number,temp,n_normal,eps
      parameter (eps = 1e-6)
c
c*********************************************      initialize
c
      temp     = abs(number)
      if( temp .lt. r_tiny_n) then
         exponent = 0.
         n_normal = 0.
      else
         exponent = log10(temp)
c hangs after here.
         temp     = temp / (10.**exponent)
         pow      = max(sigfig,(exponent+1))
         n_normal = temp + 5./10.**pow
      endif
c
c*********************************************      fix?
c
      if ( n_normal .ge. 10.-eps .and. n_normal .le. 10+eps ) then
         exponent = 0
         n_normal = 10 - eps
      elseif( n_normal .ge. 10. ) then
         exponent = exponent + 1
         temp     = temp * .1
         pow      = max(sigfig,(exponent+1))
         n_normal = temp + 5./10.**pow
      elseif( n_normal.lt. 1.) then
         exponent = exponent - 1
         temp     = temp * 10.
         pow      = max(sigfig,(exponent+1))
         n_normal = temp + 5./10.**pow
      endif
c
c*********************************************      all done
c
      return
c
      end


> And the following program executes in <4 ms with gfortran 4.3.0 20070227 and
> 4.1.3 20070218 (prerelease) (SUSE Linux).
> 
> You might want to try an newer GCC (4.1.2 or 4.2 or 4.3).
> Nightly builds of the latter two are available from:
> http://gcc.gnu.org/wiki/GFortranBinaries#GNU/Linux

  Thanks, I know about the newer versions, but what I have here is 
  basically working. I just reported this because I hate hangs
  even when I have a bug and generate infinity and then try
  to convert it to a string.

  Thanks again,

  Ray

  PS. Notice the "eps" in the last segment of code. This is 
  really a bug also. It originally was

      If ( n_normal .eq. 10. ) then

  But in some cases it missed the proper branch.


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=30981


^ permalink raw reply	[flat|nested] 17+ messages in thread

* [Bug fortran/30981] a ** exp fails for integer exponents if exp is "-huge()-1" (endless loop)
  2007-02-27 13:26 [Bug fortran/30981] New: Program "Hangs" ray at ultramarine dot com
  2007-02-27 17:07 ` [Bug fortran/30981] " burnus at gcc dot gnu dot org
  2007-02-27 18:01 ` ray at ultramarine dot com
@ 2007-02-27 19:35 ` burnus at gcc dot gnu dot org
  2007-02-27 19:52 ` ray at ultramarine dot com
                   ` (12 subsequent siblings)
  15 siblings, 0 replies; 17+ messages in thread
From: burnus at gcc dot gnu dot org @ 2007-02-27 19:35 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #3 from burnus at gcc dot gnu dot org  2007-02-27 19:35 -------
Hi,

> > Could you post an example?

With example I mean something which actually compiles and runs. Here, I have
two problems: 
      include '$(where)/amos/include/essential.ecm'
is missing as well as the main program which calls the routine. And as always:
The smaller the better.

In addition, please attach such long files, they clutter the bug report page
quite a bit if they are put into the comment field.

>       if ( n_normal .ge. 10.-eps .and. n_normal .le. 10+eps ) then
>
>   PS. Notice the "eps" in the last segment of code. This is 
>   really a bug also. It originally was 
>       If ( n_normal .eq. 10. ) then
>   But in some cases it missed the proper branch.

If you do:
  n_normal = 10.0
then  if(n_normal == 10.0)  should work. If you do
  n_normal = 500.0/100.0*2.0
then it might not work due to rounding errors and representation problems of a
decimal number as binary number. Therefore, one should almost always use
something like  if ( abs(n_normal - 10.0) < eps),  where eps is sensibly
chosen, it could be e.g. eps = epsilon(n_normal), but this might be even too
small. For irrational numbers such as 3.14159 it is more obvious that one
should use, e.g. (abs(myNumber - 3.14159) < 1e-4) instead of  "if (myNumber ==
3.14159)".


Back to the problem:

The calculation goes only into an endless loop if the exponent is
"-huge(integer)-1".

Test case:
      program test
      implicit none
      print *, 5.0**(-huge(i)-1)
      end program

The problem is that in pow_r4_i4 the following operation is done:

      if (n < 0)
        {
          n = -n;

The problem is: For n == -huge(n) - 1 exists no positive number. Thus
 n == -n == -2147483648  (for integer(4))


-- 

burnus at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|0                           |1
           Keywords|                            |wrong-code
   Last reconfirmed|0000-00-00 00:00:00         |2007-02-27 19:35:04
               date|                            |
            Summary|Program "Hangs"             |a ** exp fails for integer
                   |                            |exponents if exp is "-
                   |                            |huge()-1" (endless loop)


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=30981


^ permalink raw reply	[flat|nested] 17+ messages in thread

* [Bug fortran/30981] a ** exp fails for integer exponents if exp is "-huge()-1" (endless loop)
  2007-02-27 13:26 [Bug fortran/30981] New: Program "Hangs" ray at ultramarine dot com
                   ` (2 preceding siblings ...)
  2007-02-27 19:35 ` [Bug fortran/30981] a ** exp fails for integer exponents if exp is "-huge()-1" (endless loop) burnus at gcc dot gnu dot org
@ 2007-02-27 19:52 ` ray at ultramarine dot com
  2007-02-27 19:54 ` pinskia at gcc dot gnu dot org
                   ` (11 subsequent siblings)
  15 siblings, 0 replies; 17+ messages in thread
From: ray at ultramarine dot com @ 2007-02-27 19:52 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #4 from ray at ultramarine dot com  2007-02-27 19:52 -------
Subject: Re:  a ** exp fails for integer exponents if exp
 is "-huge()-1" (endless loop)

On Tue, 27 Feb 2007, burnus at gcc dot gnu dot org wrote:

> 
> 
> ------- Comment #3 from burnus at gcc dot gnu dot org  2007-02-27 19:35 -------
> Hi,
> 
> > > Could you post an example?
> 
> With example I mean something which actually compiles and runs. Here, I have
> two problems: 
>       include '$(where)/amos/include/essential.ecm'
> is missing as well as the main program which calls the routine. And as always:
> The smaller the better.


  I really try to do this, but I am an "old" fortran programer and 
  I do not know how to set +Infinity. Yes, of course, I have a case
  that computes it and then hangs, but my code is over 500,000 lines
  long and I did not think it is appropriate.

> In addition, please attach such long files, they clutter the bug report page
> quite a bit if they are put into the comment field.
> 
> >       if ( n_normal .ge. 10.-eps .and. n_normal .le. 10+eps ) then
> >
> >   PS. Notice the "eps" in the last segment of code. This is 
> >   really a bug also. It originally was 
> >       If ( n_normal .eq. 10. ) then
> >   But in some cases it missed the proper branch.
> 
> If you do:
>   n_normal = 10.0
> then  if(n_normal == 10.0)  should work. If you do
>   n_normal = 500.0/100.0*2.0
> then it might not work due to rounding errors and representation problems of a
> decimal number as binary number. Therefore, one should almost always use
> something like  if ( abs(n_normal - 10.0) < eps),  where eps is sensibly
> chosen, it could be e.g. eps = epsilon(n_normal), but this might be even too
> small. For irrational numbers such as 3.14159 it is more obvious that one
> should use, e.g. (abs(myNumber - 3.14159) < 1e-4) instead of  "if (myNumber ==
> 3.14159)".

  This is not as silly as it sounds. All I care about is to handle
  the special case of 10 (exactly). I have seen cases where the
  equality fails, but the number is really 10. It probably has
  something to do with how this is done. I never could get a 
  small case to fail.

> Back to the problem:
> 
> The calculation goes only into an endless loop if the exponent is
> "-huge(integer)-1".
> 
> Test case:
>       program test
>       implicit none
>       print *, 5.0**(-huge(i)-1)
>       end program
> 
> The problem is that in pow_r4_i4 the following operation is done:
> 
>       if (n < 0)
>         {
>           n = -n;
> 
> The problem is: For n == -huge(n) - 1 exists no positive number. Thus
>  n == -n == -2147483648  (for integer(4))
> 
> 
> -- 
> 
> burnus at gcc dot gnu dot org changed:
> 
>            What    |Removed                     |Added
> ----------------------------------------------------------------------------
>              Status|UNCONFIRMED                 |NEW
>      Ever Confirmed|0                           |1
>            Keywords|                            |wrong-code
>    Last reconfirmed|0000-00-00 00:00:00         |2007-02-27 19:35:04
>                date|                            |
>             Summary|Program "Hangs"             |a ** exp fails for integer
>                    |                            |exponents if exp is "-
>                    |                            |huge()-1" (endless loop)
> 
> 
> http://gcc.gnu.org/bugzilla/show_bug.cgi?id=30981
> 
> ------- You are receiving this mail because: -------
> You reported the bug, or are watching the reporter.
> 
> -------------------+  Spam Scoring Results   +------------------------
> Content analysis details:   (-2.6 hits, 5.0 required)
> -2.6 BAYES_00               BODY: Bayesian spam probability is 0 to 1%
>                             [score: 0.0033]
> 
> -------------------+ End Spam Scoring Results +-----------------------
> 


Ultramarine, Inc.
http://www.ultramarine.com
Phone: 713-975-8146
Fax:   713-975-8179


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=30981


^ permalink raw reply	[flat|nested] 17+ messages in thread

* [Bug fortran/30981] a ** exp fails for integer exponents if exp is "-huge()-1" (endless loop)
  2007-02-27 13:26 [Bug fortran/30981] New: Program "Hangs" ray at ultramarine dot com
                   ` (3 preceding siblings ...)
  2007-02-27 19:52 ` ray at ultramarine dot com
@ 2007-02-27 19:54 ` pinskia at gcc dot gnu dot org
  2007-02-27 19:58 ` ray at ultramarine dot com
                   ` (10 subsequent siblings)
  15 siblings, 0 replies; 17+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2007-02-27 19:54 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #5 from pinskia at gcc dot gnu dot org  2007-02-27 19:54 -------
Also isn't -huge()-1 undefined code for Fortran?


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=30981


^ permalink raw reply	[flat|nested] 17+ messages in thread

* [Bug fortran/30981] a ** exp fails for integer exponents if exp is "-huge()-1" (endless loop)
  2007-02-27 13:26 [Bug fortran/30981] New: Program "Hangs" ray at ultramarine dot com
                   ` (4 preceding siblings ...)
  2007-02-27 19:54 ` pinskia at gcc dot gnu dot org
@ 2007-02-27 19:58 ` ray at ultramarine dot com
  2007-02-27 20:46 ` kargl at gcc dot gnu dot org
                   ` (9 subsequent siblings)
  15 siblings, 0 replies; 17+ messages in thread
From: ray at ultramarine dot com @ 2007-02-27 19:58 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #6 from ray at ultramarine dot com  2007-02-27 19:57 -------
Subject: Re:  a ** exp fails for integer exponents if exp
 is "-huge()-1" (endless loop)

On Tue, 27 Feb 2007, pinskia at gcc dot gnu dot org wrote:

> 
> 
> ------- Comment #5 from pinskia at gcc dot gnu dot org  2007-02-27 19:54 -------
> Also isn't -huge()-1 undefined code for Fortran?
> 
> 
> -- 

  I am not familiar with the new standards, but it was
  in the past.


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=30981


^ permalink raw reply	[flat|nested] 17+ messages in thread

* [Bug fortran/30981] a ** exp fails for integer exponents if exp is "-huge()-1" (endless loop)
  2007-02-27 13:26 [Bug fortran/30981] New: Program "Hangs" ray at ultramarine dot com
                   ` (5 preceding siblings ...)
  2007-02-27 19:58 ` ray at ultramarine dot com
@ 2007-02-27 20:46 ` kargl at gcc dot gnu dot org
  2007-02-27 22:04 ` burnus at gcc dot gnu dot org
                   ` (8 subsequent siblings)
  15 siblings, 0 replies; 17+ messages in thread
From: kargl at gcc dot gnu dot org @ 2007-02-27 20:46 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #7 from kargl at gcc dot gnu dot org  2007-02-27 20:46 -------
(In reply to comment #5)
> Also isn't -huge()-1 undefined code for Fortran?

-huge()-1 can be defined in Fortran.  The problem
comes when one tries to use that value in, e.g.,
IABS() because the standard prohibits calling an
intrinsic that must return a value outside of its
defined range.

I'll also note that -pedantic will reject -huge()-1
as being outside the symmetric range of the model
numbers.


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=30981


^ permalink raw reply	[flat|nested] 17+ messages in thread

* [Bug fortran/30981] a ** exp fails for integer exponents if exp is "-huge()-1" (endless loop)
  2007-02-27 13:26 [Bug fortran/30981] New: Program "Hangs" ray at ultramarine dot com
                   ` (6 preceding siblings ...)
  2007-02-27 20:46 ` kargl at gcc dot gnu dot org
@ 2007-02-27 22:04 ` burnus at gcc dot gnu dot org
  2007-02-28 22:05 ` tkoenig at gcc dot gnu dot org
                   ` (7 subsequent siblings)
  15 siblings, 0 replies; 17+ messages in thread
From: burnus at gcc dot gnu dot org @ 2007-02-27 22:04 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #8 from burnus at gcc dot gnu dot org  2007-02-27 22:04 -------
> > Also isn't -huge()-1 undefined code for Fortran?
> -huge()-1 can be defined in Fortran.  [...]
> I'll also note that -pedantic will reject -huge()-1

Just for completeness: In the original example (the very long, incomplete F77
code) the problem was due to an overflow of:

        integer :: exponent
        ! temp very large or +INF
        exponent = log10(temp)

Thus as long as such -huge()-1 and (for floating point numbers) INF, NAN and
denormal numbers exists, the intrinsics have to deal with it somehow.


(In reply to comment #4)
> > With example I mean something which actually compiles and runs. Here, I have
> > two problems: 
> >       include '$(where)/amos/include/essential.ecm'
> > is missing as well as the main program which calls the routine.
> 
>   I really try to do this, but I am an "old" fortran programer and 
>   I do not know how to set +Infinity. Yes, of course, I have a case
>   that computes it and then hangs, but my code is over 500,000 lines
>   long and I did not think it is appropriate.

Well, given that you have 500,000+ lines, it was already quite short and I was
able to reproduce the problem even without the essential.ecm file. (Actually,
reproducing was easier than I initially feared.)

In any case: Thanks for reporting this bug.

[Comparison with 10.0]
>   This is not as silly as it sounds. All I care about is to handle
>   the special case of 10 (exactly). I have seen cases where the
>   equality fails, but the number is really 10.

I'm sure that the two numbers are then not exactly the same (bitwise) though;
nonetheless I'm not good at predicting when an operation will cause an
off-by-one (bit) and when not. I also failed to cook up a small example for
10.0

To create infinity etc. one can simply do:
  real :: zero, r
  zero = 0.0
  r = 1.0/zero ! => +INF
  r = zero/zero ! => NaN
  r = -1.0/zero ! => -INF


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=30981


^ permalink raw reply	[flat|nested] 17+ messages in thread

* [Bug fortran/30981] a ** exp fails for integer exponents if exp is "-huge()-1" (endless loop)
  2007-02-27 13:26 [Bug fortran/30981] New: Program "Hangs" ray at ultramarine dot com
                   ` (7 preceding siblings ...)
  2007-02-27 22:04 ` burnus at gcc dot gnu dot org
@ 2007-02-28 22:05 ` tkoenig at gcc dot gnu dot org
  2007-02-28 22:39 ` pinskia at gcc dot gnu dot org
                   ` (6 subsequent siblings)
  15 siblings, 0 replies; 17+ messages in thread
From: tkoenig at gcc dot gnu dot org @ 2007-02-28 22:05 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #9 from tkoenig at gcc dot gnu dot org  2007-02-28 22:04 -------
In principle, this is easy to fix:  Use
an unsigned variable for u.  In practice, this
means we have to delve into iparm.m4.  Yuck :-)

I'll look at this, but if somebody else has a
good suggestion, please go ahead.


-- 

tkoenig at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |tkoenig at gcc dot gnu dot
                   |                            |org


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=30981


^ permalink raw reply	[flat|nested] 17+ messages in thread

* [Bug fortran/30981] a ** exp fails for integer exponents if exp is "-huge()-1" (endless loop)
  2007-02-27 13:26 [Bug fortran/30981] New: Program "Hangs" ray at ultramarine dot com
                   ` (8 preceding siblings ...)
  2007-02-28 22:05 ` tkoenig at gcc dot gnu dot org
@ 2007-02-28 22:39 ` pinskia at gcc dot gnu dot org
  2007-02-28 23:13 ` Thomas dot Koenig at online dot de
                   ` (5 subsequent siblings)
  15 siblings, 0 replies; 17+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2007-02-28 22:39 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #10 from pinskia at gcc dot gnu dot org  2007-02-28 22:39 -------
Yes declare this as undefined code and close the bug :).


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=30981


^ permalink raw reply	[flat|nested] 17+ messages in thread

* [Bug fortran/30981] a ** exp fails for integer exponents if exp is "-huge()-1" (endless loop)
  2007-02-27 13:26 [Bug fortran/30981] New: Program "Hangs" ray at ultramarine dot com
                   ` (9 preceding siblings ...)
  2007-02-28 22:39 ` pinskia at gcc dot gnu dot org
@ 2007-02-28 23:13 ` Thomas dot Koenig at online dot de
  2007-02-28 23:25 ` kargl at gcc dot gnu dot org
                   ` (4 subsequent siblings)
  15 siblings, 0 replies; 17+ messages in thread
From: Thomas dot Koenig at online dot de @ 2007-02-28 23:13 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #11 from Thomas dot Koenig at online dot de  2007-02-28 23:13 -------
Subject: Re:  a ** exp fails for integer exponents if exp is "-huge()-1"
(endless loop)

> ------- Comment #10 from pinskia at gcc dot gnu dot org  2007-02-28 22:39 -------
> Yes declare this as undefined code and close the bug :).

Alternatively, attach this patch :-)

        Thomas


------- Comment #12 from Thomas dot Koenig at online dot de  2007-02-28 23:13 -------
Created an attachment (id=13127)
 --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=13127&action=view)


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=30981


^ permalink raw reply	[flat|nested] 17+ messages in thread

* [Bug fortran/30981] a ** exp fails for integer exponents if exp is "-huge()-1" (endless loop)
  2007-02-27 13:26 [Bug fortran/30981] New: Program "Hangs" ray at ultramarine dot com
                   ` (10 preceding siblings ...)
  2007-02-28 23:13 ` Thomas dot Koenig at online dot de
@ 2007-02-28 23:25 ` kargl at gcc dot gnu dot org
  2007-03-01 19:43 ` tkoenig at gcc dot gnu dot org
                   ` (3 subsequent siblings)
  15 siblings, 0 replies; 17+ messages in thread
From: kargl at gcc dot gnu dot org @ 2007-02-28 23:25 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #13 from kargl at gcc dot gnu dot org  2007-02-28 23:25 -------
(In reply to comment #12)
> Created an attachment (id=13127)
 --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=13127&action=view) [edit]
> 

Patch looks ok to me.  Note, I haven't tested.


-- 

kargl at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |kargl at gcc dot gnu dot org


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=30981


^ permalink raw reply	[flat|nested] 17+ messages in thread

* [Bug fortran/30981] a ** exp fails for integer exponents if exp is "-huge()-1" (endless loop)
  2007-02-27 13:26 [Bug fortran/30981] New: Program "Hangs" ray at ultramarine dot com
                   ` (11 preceding siblings ...)
  2007-02-28 23:25 ` kargl at gcc dot gnu dot org
@ 2007-03-01 19:43 ` tkoenig at gcc dot gnu dot org
  2007-03-04  8:04 ` tkoenig at gcc dot gnu dot org
                   ` (2 subsequent siblings)
  15 siblings, 0 replies; 17+ messages in thread
From: tkoenig at gcc dot gnu dot org @ 2007-03-01 19:43 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #14 from tkoenig at gcc dot gnu dot org  2007-03-01 19:43 -------
At least this is not a regression wrt g77.

Interestingly enough, the following program sends g77 into
a tailspin of increasing memory usage during compilation:

      program test
      a = 3.0
      print *,a**(-2147483647-1)
      end


-- 

tkoenig at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         AssignedTo|unassigned at gcc dot gnu   |tkoenig at gcc dot gnu dot
                   |dot org                     |org
             Status|NEW                         |ASSIGNED
   Last reconfirmed|2007-02-27 19:35:04         |2007-03-01 19:43:36
               date|                            |


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=30981


^ permalink raw reply	[flat|nested] 17+ messages in thread

* [Bug fortran/30981] a ** exp fails for integer exponents if exp is "-huge()-1" (endless loop)
  2007-02-27 13:26 [Bug fortran/30981] New: Program "Hangs" ray at ultramarine dot com
                   ` (12 preceding siblings ...)
  2007-03-01 19:43 ` tkoenig at gcc dot gnu dot org
@ 2007-03-04  8:04 ` tkoenig at gcc dot gnu dot org
  2007-03-08 19:27 ` [Bug fortran/30981] [4.2, 4.1 only] " tkoenig at gcc dot gnu dot org
  2007-03-08 20:38 ` [Bug fortran/30981] [4.1 " tkoenig at gcc dot gnu dot org
  15 siblings, 0 replies; 17+ messages in thread
From: tkoenig at gcc dot gnu dot org @ 2007-03-04  8:04 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #15 from tkoenig at gcc dot gnu dot org  2007-03-04 08:03 -------
Subject: Bug 30981

Author: tkoenig
Date: Sun Mar  4 08:03:34 2007
New Revision: 122522

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=122522
Log:
2007-03-04  Thomas Koenig  <Thomas.Koenig@online.de>

        PR libfortran/30981
        * m4/pow_m4: Use appropriate unsigned int type for u.
        * generated/pow_c10_i16.c: Regenerated.
        * generated/pow_c10_i4.c: Regenerated.
        * generated/pow_c10_i8.c: Regenerated.
        * generated/pow_c16_i16.c: Regenerated.
        * generated/pow_c16_i4.c: Regenerated.
        * generated/pow_c16_i8.c: Regenerated.
        * generated/pow_c4_i16.c: Regenerated.
        * generated/pow_c4_i4.c: Regenerated.
        * generated/pow_c4_i8.c: Regenerated.
        * generated/pow_c8_i16.c: Regenerated.
        * generated/pow_c8_i4.c: Regenerated.
        * generated/pow_c8_i8.c: Regenerated.
        * generated/pow_i16_i16.c: Regenerated.
        * generated/pow_i16_i4.c: Regenerated.
        * generated/pow_i16_i8.c: Regenerated.
        * generated/pow_i4_i16.c: Regenerated.
        * generated/pow_i4_i4.c: Regenerated.
        * generated/pow_i4_i8.c: Regenerated.
        * generated/pow_i8_i16.c: Regenerated.
        * generated/pow_i8_i4.c: Regenerated.
        * generated/pow_i8_i8.c: Regenerated.
        * generated/pow_r10_i16.c: Regenerated.
        * generated/pow_r10_i4.c: Regenerated.
        * generated/pow_r10_i8.c: Regenerated.
        * generated/pow_r16_i16.c: Regenerated.
        * generated/pow_r16_i4.c: Regenerated.
        * generated/pow_r16_i8.c: Regenerated.
        * generated/pow_r4_i16.c: Regenerated.
        * generated/pow_r4_i4.c: Regenerated.
        * generated/pow_r4_i8.c: Regenerated.
        * generated/pow_r8_i16.c: Regenerated.
        * generated/pow_r8_i4.c: Regenerated.
        * generated/pow_r8_i8.c: Regenerated.

2007-03-04  Thomas Koenig  <Thomas.Koenig@online.de>

        PR libfortran/30981
        * gfortran.dg/integer_exponentiation_1.f90:  New test.


Added:
    trunk/gcc/testsuite/gfortran.dg/integer_exponentiation_1.f90
Modified:
    trunk/gcc/testsuite/ChangeLog
    trunk/libgfortran/ChangeLog
    trunk/libgfortran/generated/pow_c10_i16.c
    trunk/libgfortran/generated/pow_c10_i4.c
    trunk/libgfortran/generated/pow_c10_i8.c
    trunk/libgfortran/generated/pow_c16_i16.c
    trunk/libgfortran/generated/pow_c16_i4.c
    trunk/libgfortran/generated/pow_c16_i8.c
    trunk/libgfortran/generated/pow_c4_i16.c
    trunk/libgfortran/generated/pow_c4_i4.c
    trunk/libgfortran/generated/pow_c4_i8.c
    trunk/libgfortran/generated/pow_c8_i16.c
    trunk/libgfortran/generated/pow_c8_i4.c
    trunk/libgfortran/generated/pow_c8_i8.c
    trunk/libgfortran/generated/pow_i16_i16.c
    trunk/libgfortran/generated/pow_i16_i4.c
    trunk/libgfortran/generated/pow_i16_i8.c
    trunk/libgfortran/generated/pow_i4_i16.c
    trunk/libgfortran/generated/pow_i4_i4.c
    trunk/libgfortran/generated/pow_i4_i8.c
    trunk/libgfortran/generated/pow_i8_i16.c
    trunk/libgfortran/generated/pow_i8_i4.c
    trunk/libgfortran/generated/pow_i8_i8.c
    trunk/libgfortran/generated/pow_r10_i16.c
    trunk/libgfortran/generated/pow_r10_i4.c
    trunk/libgfortran/generated/pow_r10_i8.c
    trunk/libgfortran/generated/pow_r16_i16.c
    trunk/libgfortran/generated/pow_r16_i4.c
    trunk/libgfortran/generated/pow_r16_i8.c
    trunk/libgfortran/generated/pow_r4_i16.c
    trunk/libgfortran/generated/pow_r4_i4.c
    trunk/libgfortran/generated/pow_r4_i8.c
    trunk/libgfortran/generated/pow_r8_i16.c
    trunk/libgfortran/generated/pow_r8_i4.c
    trunk/libgfortran/generated/pow_r8_i8.c
    trunk/libgfortran/m4/pow.m4


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=30981


^ permalink raw reply	[flat|nested] 17+ messages in thread

* [Bug fortran/30981] [4.2, 4.1 only] a ** exp fails for integer exponents if exp is "-huge()-1" (endless loop)
  2007-02-27 13:26 [Bug fortran/30981] New: Program "Hangs" ray at ultramarine dot com
                   ` (13 preceding siblings ...)
  2007-03-04  8:04 ` tkoenig at gcc dot gnu dot org
@ 2007-03-08 19:27 ` tkoenig at gcc dot gnu dot org
  2007-03-08 20:38 ` [Bug fortran/30981] [4.1 " tkoenig at gcc dot gnu dot org
  15 siblings, 0 replies; 17+ messages in thread
From: tkoenig at gcc dot gnu dot org @ 2007-03-08 19:27 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #16 from tkoenig at gcc dot gnu dot org  2007-03-08 19:27 -------
Subject: Bug 30981

Author: tkoenig
Date: Thu Mar  8 19:26:55 2007
New Revision: 122708

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=122708
Log:
2007-03-08  Thomas Koenig  <Thomas.Koenig@online.de>

        PR libfortran/30981
        Backport from trunk.
        * m4/pow_m4: Use appropriate unsigned int type for u.
        * generated/pow_c10_i16.c: Regenerated.
        * generated/pow_c10_i4.c: Regenerated.
        * generated/pow_c10_i8.c: Regenerated.
        * generated/pow_c16_i16.c: Regenerated.
        * generated/pow_c16_i4.c: Regenerated.
        * generated/pow_c16_i8.c: Regenerated.
        * generated/pow_c4_i16.c: Regenerated.
        * generated/pow_c4_i4.c: Regenerated.
        * generated/pow_c4_i8.c: Regenerated.
        * generated/pow_c8_i16.c: Regenerated.
        * generated/pow_c8_i4.c: Regenerated.
        * generated/pow_c8_i8.c: Regenerated.
        * generated/pow_i16_i16.c: Regenerated.
        * generated/pow_i16_i4.c: Regenerated.
        * generated/pow_i16_i8.c: Regenerated.
        * generated/pow_i4_i16.c: Regenerated.
        * generated/pow_i4_i4.c: Regenerated.
        * generated/pow_i4_i8.c: Regenerated.
        * generated/pow_i8_i16.c: Regenerated.
        * generated/pow_i8_i4.c: Regenerated.
        * generated/pow_i8_i8.c: Regenerated.
        * generated/pow_r10_i16.c: Regenerated.
        * generated/pow_r10_i4.c: Regenerated.
        * generated/pow_r10_i8.c: Regenerated.
        * generated/pow_r16_i16.c: Regenerated.
        * generated/pow_r16_i4.c: Regenerated.
        * generated/pow_r16_i8.c: Regenerated.
        * generated/pow_r4_i16.c: Regenerated.
        * generated/pow_r4_i4.c: Regenerated.
        * generated/pow_r4_i8.c: Regenerated.
        * generated/pow_r8_i16.c: Regenerated.
        * generated/pow_r8_i4.c: Regenerated.
        * generated/pow_r8_i8.c: Regenerated.

2007-03-08  Thomas Koenig  <Thomas.Koenig@online.de>

        PR libfortran/30981
        Backport from trunk.
        * gfortran.dg/integer_exponentiation_1.f90:  New test.


Added:
   
branches/gcc-4_2-branch/gcc/testsuite/gfortran.dg/integer_exponentiation_1.f90
Modified:
    branches/gcc-4_2-branch/gcc/testsuite/ChangeLog
    branches/gcc-4_2-branch/libgfortran/ChangeLog
    branches/gcc-4_2-branch/libgfortran/generated/pow_c10_i16.c
    branches/gcc-4_2-branch/libgfortran/generated/pow_c10_i4.c
    branches/gcc-4_2-branch/libgfortran/generated/pow_c10_i8.c
    branches/gcc-4_2-branch/libgfortran/generated/pow_c16_i16.c
    branches/gcc-4_2-branch/libgfortran/generated/pow_c16_i4.c
    branches/gcc-4_2-branch/libgfortran/generated/pow_c16_i8.c
    branches/gcc-4_2-branch/libgfortran/generated/pow_c4_i16.c
    branches/gcc-4_2-branch/libgfortran/generated/pow_c4_i4.c
    branches/gcc-4_2-branch/libgfortran/generated/pow_c4_i8.c
    branches/gcc-4_2-branch/libgfortran/generated/pow_c8_i16.c
    branches/gcc-4_2-branch/libgfortran/generated/pow_c8_i4.c
    branches/gcc-4_2-branch/libgfortran/generated/pow_c8_i8.c
    branches/gcc-4_2-branch/libgfortran/generated/pow_i16_i16.c
    branches/gcc-4_2-branch/libgfortran/generated/pow_i16_i4.c
    branches/gcc-4_2-branch/libgfortran/generated/pow_i16_i8.c
    branches/gcc-4_2-branch/libgfortran/generated/pow_i4_i16.c
    branches/gcc-4_2-branch/libgfortran/generated/pow_i4_i4.c
    branches/gcc-4_2-branch/libgfortran/generated/pow_i4_i8.c
    branches/gcc-4_2-branch/libgfortran/generated/pow_i8_i16.c
    branches/gcc-4_2-branch/libgfortran/generated/pow_i8_i4.c
    branches/gcc-4_2-branch/libgfortran/generated/pow_i8_i8.c
    branches/gcc-4_2-branch/libgfortran/generated/pow_r10_i16.c
    branches/gcc-4_2-branch/libgfortran/generated/pow_r10_i4.c
    branches/gcc-4_2-branch/libgfortran/generated/pow_r10_i8.c
    branches/gcc-4_2-branch/libgfortran/generated/pow_r16_i16.c
    branches/gcc-4_2-branch/libgfortran/generated/pow_r16_i4.c
    branches/gcc-4_2-branch/libgfortran/generated/pow_r16_i8.c
    branches/gcc-4_2-branch/libgfortran/generated/pow_r4_i16.c
    branches/gcc-4_2-branch/libgfortran/generated/pow_r4_i4.c
    branches/gcc-4_2-branch/libgfortran/generated/pow_r4_i8.c
    branches/gcc-4_2-branch/libgfortran/generated/pow_r8_i16.c
    branches/gcc-4_2-branch/libgfortran/generated/pow_r8_i4.c
    branches/gcc-4_2-branch/libgfortran/generated/pow_r8_i8.c
    branches/gcc-4_2-branch/libgfortran/m4/pow.m4


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=30981


^ permalink raw reply	[flat|nested] 17+ messages in thread

* [Bug fortran/30981] [4.1 only] a ** exp fails for integer exponents if exp is "-huge()-1" (endless loop)
  2007-02-27 13:26 [Bug fortran/30981] New: Program "Hangs" ray at ultramarine dot com
                   ` (14 preceding siblings ...)
  2007-03-08 19:27 ` [Bug fortran/30981] [4.2, 4.1 only] " tkoenig at gcc dot gnu dot org
@ 2007-03-08 20:38 ` tkoenig at gcc dot gnu dot org
  15 siblings, 0 replies; 17+ messages in thread
From: tkoenig at gcc dot gnu dot org @ 2007-03-08 20:38 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #17 from tkoenig at gcc dot gnu dot org  2007-03-08 20:38 -------
Fixed on trunk and 4.2.  Closing.


-- 

tkoenig at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
         Resolution|                            |FIXED
            Summary|[4.2, 4.1 only] a ** exp    |[4.1 only] a ** exp fails
                   |fails for integer exponents |for integer exponents if exp
                   |if exp is "-huge()-1"       |is "-huge()-1" (endless
                   |(endless loop)              |loop)


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=30981


^ permalink raw reply	[flat|nested] 17+ messages in thread

end of thread, other threads:[~2007-03-08 20:38 UTC | newest]

Thread overview: 17+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-02-27 13:26 [Bug fortran/30981] New: Program "Hangs" ray at ultramarine dot com
2007-02-27 17:07 ` [Bug fortran/30981] " burnus at gcc dot gnu dot org
2007-02-27 18:01 ` ray at ultramarine dot com
2007-02-27 19:35 ` [Bug fortran/30981] a ** exp fails for integer exponents if exp is "-huge()-1" (endless loop) burnus at gcc dot gnu dot org
2007-02-27 19:52 ` ray at ultramarine dot com
2007-02-27 19:54 ` pinskia at gcc dot gnu dot org
2007-02-27 19:58 ` ray at ultramarine dot com
2007-02-27 20:46 ` kargl at gcc dot gnu dot org
2007-02-27 22:04 ` burnus at gcc dot gnu dot org
2007-02-28 22:05 ` tkoenig at gcc dot gnu dot org
2007-02-28 22:39 ` pinskia at gcc dot gnu dot org
2007-02-28 23:13 ` Thomas dot Koenig at online dot de
2007-02-28 23:25 ` kargl at gcc dot gnu dot org
2007-03-01 19:43 ` tkoenig at gcc dot gnu dot org
2007-03-04  8:04 ` tkoenig at gcc dot gnu dot org
2007-03-08 19:27 ` [Bug fortran/30981] [4.2, 4.1 only] " tkoenig at gcc dot gnu dot org
2007-03-08 20:38 ` [Bug fortran/30981] [4.1 " tkoenig at gcc dot gnu dot org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).