Bug 44346 - gfortran accepts illegal arguments to intrinsics
Summary: gfortran accepts illegal arguments to intrinsics
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: fortran (show other bugs)
Version: 4.5.0
: P3 normal
Target Milestone: ---
Assignee: kargls
URL:
Keywords: diagnostic
Depends on:
Blocks:
 
Reported: 2010-05-31 16:16 UTC by Vittorio Zecca
Modified: 2010-06-09 16:39 UTC (History)
1 user (show)

See Also:
Host: x86_64-unknown-linux-gnu
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed: 2010-05-31 17:22:21


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Vittorio Zecca 2010-05-31 16:16:34 UTC
gfortran should not accept the following:
      
character s,ss(1),pad(1),order(1)
      integer nn(7)
c gfortran should complain that POS and LEN are negative
      print *,ibits(i,-1,-1)
c POS+LEN>BIT_SIZE(i)
      print *,ibits(i,100,100)
c 30+3>32
      call mvbits(n,30,3,n,1)
c 31+2>32
      call mvbits(n,30,2,n,31)
c LEN negative
      call mvbits(n,30,-2,n,30)
c TOPOS negative
      call mvbits(n,30,2,n,-3)
c FROMPOS negative
      call mvbits(n,-1,2,n,3)
      end

Best regards
Vittorio Zecca
Comment 1 kargls 2010-05-31 16:29:02 UTC
Thanks for the bug report.  Technically, the prohibition of
nonnegative is on the programmer, and as such the code is
illegal.  gfortran can do anything it wants with the program
including starting world war iii.  OTOH, this appears to be
a quality-of-implementation issue, and if gfortran can diagnosis
the problem, and error should be emitted.
Comment 2 kargls 2010-05-31 17:22:21 UTC
I have a patch for the IBITS() portion of the problem.
Comment 3 kargls 2010-05-31 17:51:09 UTC
I have a complete patch with the mvbits checking done.
Comment 4 Tobias Burnus 2010-06-01 07:45:50 UTC
Steve's patch: http://gcc.gnu.org/ml/fortran/2010-06/msg00002.html
Comment 5 kargls 2010-06-09 16:39:23 UTC
Patch has been committed to 4.4, 4.5, and trunk.
Closing.