sloppy-char flag strangeness

8 views
Skip to first unread message

Norminator

unread,
May 28, 2009, 4:06:35 PM5/28/09
to gg95
Hello,

I have a strange problem for which I am looking for assistance. I
have included a small program and make file. The code performs two
tasks that are relevent to the issue. The first is a formatted write
statement that uses an old construct (the requires the -fsloppy-char
flag to run), and the second is an if-statement that uses a derived
type.

If I compile using an old version of g95 (like circa 2006), both
operations work fine.

If I use the current version of g95, the comparison in the
if-statement is not performed when the -fsloppy-char flag is used.
But if the -fsloppy-char flag is not used, then the if-statement does
work, but the formatted output is illegal obviously.

The problem is that I need both these things to work with the latest
version. Can you help?

Thanks


--------------------- program ---------------------------


module derived_type_EnumVar
implicit none

save

type :: EnumVar
integer :: first_index = 1
end type EnumVar

!-Interface operators

interface operator (==)
module procedure string_compare_eq
end interface

contains

function string_compare_eq(var,string)
implicit none
logical :: string_compare_eq
type(EnumVar), intent(in) :: var
character(*), intent(in) :: string

string_compare_eq = .true.

return
end function string_compare_eq

end module derived_type_EnumVar

program issue
use derived_type_EnumVar
implicit none

type(EnumVar) :: myVar

write(*,9000) 67,65,84

if (myVar == "test") then
write(*,*) 'Test was attempted'
else
write(*,*) 'Test was NOT attempted'
endif

write(*,*) 'end'

9000 format ('Write CAT in old crappy way:',1x,3a6)
end



------------------------ makefile --------------------------


#

PROG = issue

# old g95 that works fine
#F90 = /home/local/g95/bin/x86_64-unknown-linux-gnu-g95

# new g95 that needs sloppy-char for the 3a6 output but fails
# on the derived type comparison
F90 = /home/local/g95.092/bin/x86_64-unknown-linux-gnu-g95

FFLAGS = fsloppy-char

MODULES = main.o

$(PROG) : $(MODULES) $(OBJECTS)
$(F90) -o $(PROG) $(FFLAGS) $(OBJECTS) $(MODULES)

.SUFFIXES: .f .f90 .F .F90 .c .C

$(MODULES) :
$(OBJECTS) : $(MODULES)


.f90.o :
$(F90) -c $(FFLAGS) $<

clean :
rm -f *.o *.mod
rm -f ./issue


Reply all
Reply to author
Forward
0 new messages