- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
The following non-conforming code should be rejected by ifort/ifx, but currently is not:
program p
  type t
     integer :: a
  end type
  type(t) :: x
  data x /t(null())/
end
This is for
% ifort -V
Intel(R) Fortran Intel(R) 64 Compiler Classic for applications running on Intel(R) 64, Version 2021.2.0 Build 20210228_000000
Thanks,
Harald
		1 Solution
	
		
			- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I agree that this is nonconforming, and no reasonable interpretation exists. NULL() is allowed to be used in DATA, but only when it corresponds to a POINTER.
Link Copied
		3 Replies
	
		
		
			
			
			
					
	
			- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
  program p
  type t
     integer :: a
  end type
  type(t) :: x
  data x /t(null())/
  
  write(*,*)x%a
end
x%a is initialed to 0
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
program p
  type t
     integer :: a
  end type
  
  type ta
    real, pointer :: ptr => null()
  end type
  
  type(ta) :: xa
  
  type(t) :: x
  
  data x /t(null())/
  allocate(xa%ptr)
  
  
  write(*,*)x%a
endxa%ptr is now a very small real -- LISP is nice it tells you the side effects.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I agree that this is nonconforming, and no reasonable interpretation exists. NULL() is allowed to be used in DATA, but only when it corresponds to a POINTER.
 
					
				
				
			
		
					
					Reply
					
						
	
		
				
				
				
					
						
					
				
					
				
				
				
				
			
			Topic Options
			
				
					
	
			
		
	- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page