This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [gfortran] PATCH: Allow wide boz constants


> - Tobi
>
> 2004-10-06  Tobias Schlueter  <tobias.schlueter@physik.uni-muenchen.de>
>
>  * primary.c (match_boz_constant): Determine required bit width from
>  constant.

No. Your patch breaks the following program. Beofre your patch it calle foo1, 
after it calls foo2. Similar bad things could happen with implicit 
interfaces.

program boz_type
  interface foo
    subroutine foo1(i)
      integer i
    end subroutine
    subroutine foo2(i)
      integer(kind=1) :: i
    end subroutine
  end interface
  call foo(z'f')
end program

There's also ambiguity when the sign bit is set. For example:
  integer*8 i
  i = z'0ffffffff'
Should i be set to -1 or 4294967295? gfortran and g77 currently give different 
answers for this.

How about using the smallest kind possible, but never smaller than the default 
kind. Probably also add -Wlarge-boz-constant or similar.

Paul


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]