public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/39312]  New: parameter (constant) and initialization with hex values
@ 2009-02-26 14:32 rvatne at gmail dot com
  2009-02-26 14:42 ` [Bug fortran/39312] " kargl at gcc dot gnu dot org
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: rvatne at gmail dot com @ 2009-02-26 14:32 UTC (permalink / raw)
  To: gcc-bugs

How can initialization of a parameter (constant) with hex values be done?

I.e. I would like to write "parameter (xx = z'ff')" 
or 
integer, parameter :: zz=z'022'
but the compiler complains over "BOZ used outside a data statement"


-- 
           Summary: parameter (constant) and initialization with hex values
           Product: gcc
           Version: 4.3.3
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: rvatne at gmail dot com
 GCC build triplet: sparc-sun-solaris2.8
  GCC host triplet: sparc-sun-solaris2.8
GCC target triplet: sparc-sun-solaris2.8


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


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

* [Bug fortran/39312] parameter (constant) and initialization with hex values
  2009-02-26 14:32 [Bug fortran/39312] New: parameter (constant) and initialization with hex values rvatne at gmail dot com
@ 2009-02-26 14:42 ` kargl at gcc dot gnu dot org
  2009-02-26 14:59 ` rvatne at gmail dot com
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: kargl at gcc dot gnu dot org @ 2009-02-26 14:42 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from kargl at gcc dot gnu dot org  2009-02-26 14:42 -------
You need to give some details, including a small program,
the compiler command line you used, and the output of 
gfortran -v.

Because it works for me.

laptop:kargl[6] cat > a.f
       program z
       integer j
       parameter (j = z'ff')
       print *, j
       end program z
^Dlaptop:kargl[7] 
laptop:kargl[7] gfc43 -o z a.f
laptop:kargl[8] ./z
         255


-- 

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=39312


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

* [Bug fortran/39312] parameter (constant) and initialization with hex values
  2009-02-26 14:32 [Bug fortran/39312] New: parameter (constant) and initialization with hex values rvatne at gmail dot com
  2009-02-26 14:42 ` [Bug fortran/39312] " kargl at gcc dot gnu dot org
@ 2009-02-26 14:59 ` rvatne at gmail dot com
  2009-02-26 15:09 ` sgk at troutmask dot apl dot washington dot edu
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: rvatne at gmail dot com @ 2009-02-26 14:59 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #2 from rvatne at gmail dot com  2009-02-26 14:59 -------
(In reply to comment #1)
> You need to give some details, including a small program,
> the compiler command line you used, and the output of 
> gfortran -v.
> 
> Because it works for me.
> 
> laptop:kargl[6] cat > a.f
>        program z
>        integer j
>        parameter (j = z'ff')
>        print *, j
>        end program z
> ^Dlaptop:kargl[7] 
> laptop:kargl[7] gfc43 -o z a.f
> laptop:kargl[8] ./z
>          255
> 

(In reply to comment #1)
> You need to give some details, including a small program,
> the compiler command line you used, and the output of 
> gfortran -v.
> 
> Because it works for me.
> 
> laptop:kargl[6] cat > a.f
>        program z
>        integer j
>        parameter (j = z'ff')
>        print *, j
>        end program z
> ^Dlaptop:kargl[7] 
> laptop:kargl[7] gfc43 -o z a.f
> laptop:kargl[8] ./z
>          255
> 


>gfortran -v
Using built-in specs.
Target: sparc-sun-solaris2.8
Configured with: /t3-0/shared/gnu/gcc-4.3.3/configure
--prefix=/t3-0/shared/gnu/gcc-trunk --srcdir=/t3-0/shared/gnu/gcc-4.3.3
--enable-languages=c,fortran --with-mpfr=/usr/local --with-gmp=/usr/local
--with-pkgversion=432
Thread model: posix
gcc version 4.3.3 (432) 


program:
>cat rv1.f
       SUBROUTINE SLSYNOF(TSN,UFD,STATUS)

       INCLUDE 'rvp.mnc'

! --   DO something
       RETURN

       END


includefile:
>cat rvp.mnc 
! includefile

      PARAMETER (SL_I4NOVALUE = Z'80000000')
!      INTEGER :: SL_I4NOVALUE
!      DATA SL_I4NOVALUE / Z'80000000'/
!      PARAMETER (SL_I4NOVALUE = SL_I4NOVALUED )

!      integer, parameter :: ipm = 2
!      data ipm /z'033'/





running:
>gfortran -g -std=f95 -ffree-form -frange-check -c rv1.f90  -o rv1.o
rvp.mnc:3.43:
    Included at rv1.f90:2:

      PARAMETER (SL_I4NOVALUE = Z'80000000')
                                           1
Error: Fortran 2003: BOZ used outside a DATA statement at (1)


-- 


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


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

* [Bug fortran/39312] parameter (constant) and initialization with hex values
  2009-02-26 14:32 [Bug fortran/39312] New: parameter (constant) and initialization with hex values rvatne at gmail dot com
  2009-02-26 14:42 ` [Bug fortran/39312] " kargl at gcc dot gnu dot org
  2009-02-26 14:59 ` rvatne at gmail dot com
@ 2009-02-26 15:09 ` sgk at troutmask dot apl dot washington dot edu
  2009-02-26 15:10 ` rguenth at gcc dot gnu dot org
  2009-02-26 15:11 ` kargl at gcc dot gnu dot org
  4 siblings, 0 replies; 6+ messages in thread
From: sgk at troutmask dot apl dot washington dot edu @ 2009-02-26 15:09 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #3 from sgk at troutmask dot apl dot washington dot edu  2009-02-26 15:09 -------
Subject: Re:  parameter (constant) and initialization with hex values

On Thu, Feb 26, 2009 at 02:59:05PM -0000, rvatne at gmail dot com wrote:
> 
> running:
> >gfortran -g -std=f95 -ffree-form -frange-check -c rv1.f90  -o rv1.o
> rvp.mnc:3.43:
>     Included at rv1.f90:2:
> 
>       PARAMETER (SL_I4NOVALUE = Z'80000000')
>                                            1
> Error: Fortran 2003: BOZ used outside a DATA statement at (1)
> 

You got exactly what you asked the compiler to do.
Remove the -std=f95 option if you don't want to 
enforce the Fortran 95 standard.


-- 


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


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

* [Bug fortran/39312] parameter (constant) and initialization with hex values
  2009-02-26 14:32 [Bug fortran/39312] New: parameter (constant) and initialization with hex values rvatne at gmail dot com
                   ` (2 preceding siblings ...)
  2009-02-26 15:09 ` sgk at troutmask dot apl dot washington dot edu
@ 2009-02-26 15:10 ` rguenth at gcc dot gnu dot org
  2009-02-26 15:11 ` kargl at gcc dot gnu dot org
  4 siblings, 0 replies; 6+ messages in thread
From: rguenth at gcc dot gnu dot org @ 2009-02-26 15:10 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #4 from rguenth at gcc dot gnu dot org  2009-02-26 15:09 -------
*** Bug 39313 has been marked as a duplicate of this bug. ***


-- 


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


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

* [Bug fortran/39312] parameter (constant) and initialization with hex values
  2009-02-26 14:32 [Bug fortran/39312] New: parameter (constant) and initialization with hex values rvatne at gmail dot com
                   ` (3 preceding siblings ...)
  2009-02-26 15:10 ` rguenth at gcc dot gnu dot org
@ 2009-02-26 15:11 ` kargl at gcc dot gnu dot org
  4 siblings, 0 replies; 6+ messages in thread
From: kargl at gcc dot gnu dot org @ 2009-02-26 15:11 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #5 from kargl at gcc dot gnu dot org  2009-02-26 15:10 -------
BOZ are allowed in data statements only in Fortran 95.


-- 

kargl at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|                            |INVALID


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


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

end of thread, other threads:[~2009-02-26 15:11 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-02-26 14:32 [Bug fortran/39312] New: parameter (constant) and initialization with hex values rvatne at gmail dot com
2009-02-26 14:42 ` [Bug fortran/39312] " kargl at gcc dot gnu dot org
2009-02-26 14:59 ` rvatne at gmail dot com
2009-02-26 15:09 ` sgk at troutmask dot apl dot washington dot edu
2009-02-26 15:10 ` rguenth at gcc dot gnu dot org
2009-02-26 15:11 ` kargl 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).