This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug fortran/12456] New: please recognize Fortran STRING(K:K) as single


PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.

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

           Summary: please recognize Fortran STRING(K:K) as single
           Product: gcc
           Version: 3.2
            Status: UNCONFIRMED
          Severity: enhancement
          Priority: P3
         Component: fortran
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: arobb at mva dot co dot uk
                CC: gcc-bugs at gcc dot gnu dot org
 GCC build triplet: sparc-sun-solaris2.9
  GCC host triplet: sparc-sun-solaris2.9
GCC target triplet: sparc-sun-solaris2.9

	I would like A(I:I) to be recognized as being a single
character.
	
	The statement:
	A(I:I)=B(J:J)
	is expanded to a full _s_cpy call for each character,
whereas:
	A(1:1)=B(2:2)
	is recognised as a single character assignment.
	Currently I overcome the problem with a call to:
	
	SUBROUTINE CHRCPY(A,B)
	CHARACTER A,B
	A=B
	END
	...
	CALL CHRCPY(A(I:I),B(J:J))
	
	At -O3 this gets inlined as a single character assignment,
	which is what I want. This is not intuitive and only works
within
	a program unit.
	
	Similarly:
	A(I:I).EQ.B(J:J)
	gets expanded to a call to _s_cmp for each character.
	This can be overcome with:
	ICHAR(A(I:I)).EQ.ICHAR(B(J:J))

Environment:
System: SunOS daedelus 5.9 Generic_112233-05 sun4u sparc
SUNW,Ultra-Enterprise
Architecture: sun4

	cygwin and Solaris
host: sparc-sun-solaris2.9
build: sparc-sun-solaris2.9
target: sparc-sun-solaris2.9
configured with: ../configure --with-as=/usr/ccs/bin/as
--with-ld=/usr/ccs/bin/ld --disable-nls

How-To-Repeat:
	PROGRAM test
	CHARACTER*26 A,B
	DATA A/'abcdefghijklmnopqrstuvwxyz'/
	DO I=1,26
 	  B(I:I)=CHAR(ICHAR(A(I:I))+ICHAR('A')-ICHAR('a'))
 	END DO
 	END
------- Additional Comments From arobb at mva dot co dot uk  2003-09-30 08:46 -------
Fix:
	CALL CHRCPY(B(I:I),CHAR(ICHAR(A(I:I)+ICHAR('A')-ICHAR('a')))
	and compile with -finline-functions
	For comparisons use:
	ICHAR(A(I:I)).EQ.ICHAR(B(I:I))

________________________________________________________________________
This e-mail has been scanned for all viruses by Star Internet. The
service is powered by MessageLabs. For more information on a proactive
anti-virus service working around the clock, around the globe, visit:
http://www.star.net.uk
________________________________________________________________________


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]