Bug 56503 - Wrong compiler error message when compiling with default-real-8 option and using intrinsic dble
Summary: Wrong compiler error message when compiling with default-real-8 option and us...
Status: RESOLVED INVALID
Alias: None
Product: gcc
Classification: Unclassified
Component: fortran (show other bugs)
Version: 4.7.1
: P3 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-03-01 21:25 UTC by Maarten Becker
Modified: 2013-03-01 21:57 UTC (History)
1 user (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Maarten Becker 2013-03-01 21:25:09 UTC
Hi!

I compile the little program beneath with 
'gfortran -fdefault-integer-8 -fdefault-real-8' command.

I get:
'call t1 ( dble(r4))
          1
Error: Type mismatch in argument 'r' at (1); passed REAL(16) to REAL(8) '

Since r4 is a single precision variable the dble should make a real*8 of it, or?

The same happens when activating the real*4::r4 declaration in the module.

Thanks,
Maarten


Program, that produces the error:

-----------------------------------

module test

!real*4 :: r4

contains

subroutine t1( r)
real*8 :: r

print*,' hallo r=',r

return
end subroutine t1

end module

program t
use test
real*4 :: r4
r4 = 4
call t1 ( dble(r4))
end program

-----------------------------------
Comment 1 kargls 2013-03-01 21:57:07 UTC
(In reply to comment #0)
> Hi!
> 
> I compile the little program beneath with 
> 'gfortran -fdefault-integer-8 -fdefault-real-8' command.
> 
> I get:
> 'call t1 ( dble(r4))
>           1
> Error: Type mismatch in argument 'r' at (1); passed REAL(16) to REAL(8) '
> 
> Since r4 is a single precision variable the dble should make a real*8 of it,
> or?

The error message says 'r' not 'r4'.  The 'r' here comes from
the explicit interface for t1, which has a declaration of 
real*8.  So, if you read the documentation that comes with
your compiler, you see that 'r' has been promoted to real*16.


`-fdefault-double-8'
     Set the `DOUBLE PRECISION' type to an 8 byte wide type.  If
     `-fdefault-real-8' is given, `DOUBLE PRECISION' would instead be
     promoted to 16 bytes if possible, and `-fdefault-double-8' can be
     used to prevent this.

You probably meant to use -freal-4-real-8.  I recommend using none 
of these options and actually writing properly ported code.