Bug 25705 - fortran goto from inner IF to outer ELSE (more complex than PR17708)
fortran goto from inner IF to outer ELSE (more complex than PR17708)
Status: RESOLVED DUPLICATE of bug 18540
Product: gcc
Classification: Unclassified
Component: fortran
4.1.0
: P3 normal
: ---
Assigned To: Not yet assigned to anyone
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2006-01-06 23:56 UTC by Ray Malitzke
Modified: 2006-01-08 17:37 UTC (History)
5 users (show)

See Also:
Host: powerpc-linux-gnu (really front-end)
Target: powerpc-linux-gnu
Build: powerpc-linux-gnu
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 Ray Malitzke 2006-01-06 23:56:43 UTC
*      Reduced FORTRAN program form HFS.f in package atsp

*      A General Program for Computing Magnetic Dipole and
*      Electric Quadrupole Hyperfine Constants 
*
*               C O P Y R I G H T -- 1994
*
*      P. Jonsson and C.G. Wahlstrom, Department of Physics,  
*                                     Lund Institute of Technology,
*                                     P.O. Box 118,S-221 00 Lund
*                                     Sweden 
*      C. Froese Fischer,             Department of Computer Science
*                                     Vanderbilt University,
*                                     Nashville, TN 37235
*                                     USA
*
*     Computer Physics Communication, Vol. 74, 399--414 (1993)

      subroutine qq ! (reduced by rmg from above)
*                       DIMENSION STATEMENTS

      PARAMETER (KFL1=60,KFL2=12)
      DIMENSION J2STO(KFL2,3),J3STO(KFL2,3),NBAR(KFL2),
     :          JBAR(KFL2,3),JPBAR(KFL2,3)

*                       COMMON BLOCKS

      LOGICAL FAIL,FREE

      COMMON/TENSOR/VVSHELL(50),IIHSH,NNOVLP(50),IIRHO(50),IISIG(50),
     1 MMU(50),MMUP(50),NNU(50),NNUP(50)
      COMMON/COUPLE/NJ1S,NJ23S,J1(KFL1),J2(KFL2,3),J3(KFL2,3),FREE(KFL1)
      COMMON/INFORM/IREADC,IWRITE,IOUT,IREADJ,IREADW,ISCW,IREAD,ISC(4)
      COMMON/KRON/IDEL(10,10)
      COMMON/MEDEFN/IHSH,NJ(10),LJ(10),NOSH1(10),NOSH2(10),J1QN1(19,3)
     1    ,J1QN2(19,3),IJFUL(10)
      COMMON/DEBUG/IBUG1,IBUG2,IBUG3,NBUG6,NBUG7,IFULL
      COMMON/TERMS/NROWS,ITAB(24),JTAB(24),NTAB(333)
      COMMON/CONSTS/ZERO,TENTH,HALF,ONE,TWO,THREE,FOUR,SEVEN,ELEVEN,EPS
      COMMON/OVRLAP/MU,NU,MUP,NUP,NONORT,NOVLPS,IROWMU,IROWNU,ICOLMU,
     1 ICOLNU,NORTH,IORDER,NCALLS,LMU,LNU,LMUP,LNUP,JMU,JNU,JMUP,JNUP
      COMMON/OVRINT/IOVEL(2),IOVER(2),IOVEP(2)
      COMMON/MACHOR/IMATCH(2)
      COMMON/FACT/GAM(100)
      COMMON/EMS/IEM(4),JI,JF,IFL


*     INTERACTING SUBSHELL ON R.H.S. FOUND. THE ONE ON L.H.S. MUST
*     BE EITHER MU OR NU
*
  506 IF(IX.EQ.0.AND.IY.EQ.1) THEN
         IF(IBACK3.EQ.0) THEN
            IRHO=MU
            IF(MU.NE.NU) IBACK3=1
            MGO=MATCH(IONE,IZERO,IZERO,IZERO)
            IF(MGO.EQ.0) THEN
               IRHO=0
               RETURN
            ELSEIF(MGO.EQ.1) THEN
               IF(IBACK3.EQ.1) THEN
                  MU=MUSTO
                  NU=NUSTO
                  MUP=MUPSTO
                  NUP=NUPSTO
                  NOVLPS=NOVSTO
                  LMU=LMUSTO
                  LNU=LNUSTO
                  LMUP=LMUPST
                  LNUP=LNUPST
                  GO TO 105 ! rmg questionable goto
               ELSE
                  IRHO=0
                  RETURN
               ENDIF
            ELSE
               GO TO 108
            ENDIF
         ELSE
  105       IRHO=NU
            RML=ZERO
            RML2=ZERO
            IBACK3=0
            MGO=MATCH(IZERO,IONE,IZERO,IZERO)
            IF(MGO.EQ.2) GO TO 108
            IRHO=0
            RETURN
         ENDIF
  108 MEMR=IRHO
      ENDIF
      END

gcc-.3.4.5  SPECS

Reading specs from /usr/lib/gcc/powerpc-unknown-linux-gnu/3.4.5/specs
Configured with: /var/tmp/portage/gcc-3.4.5/work/gcc-3.4.5/configure --prefix=/usr
--bindir=/usr/powerpc-unknown-linux-gnu/gcc-bin/3.4.5
--includedir=/usr/lib/gcc/powerpc-unknown-linux-gnu/3.4.5/include
--datadir=/usr/share/gcc-data/powerpc-unknown-linux-gnu/3.4.5
--mandir=/usr/share/gcc-data/powerpc-unknown-linux-gnu/3.4.5/man
--infodir=/usr/share/gcc-data/powerpc-unknown-linux-gnu/3.4.5/info
--with-gxx-include-dir=/usr/lib/gcc/powerpc-unknown-linux-gnu/3.4.5/include/g++-v3
--host=powerpc-unknown-linux-gnu --build=powerpc-unknown-linux-gnu --disable-altivec
--enable-nls --without-included-gettext --with-system-zlib --disable-checking
--disable-werror --disable-libunwind-exceptions --disable-multilib --disable-libmudflap
--disable-libgcj --enable-languages=c,c++,objc,f77 --enable-shared --enable-threads=posix
--enable-__cxa_atexit --enable-clocale=gnu
Thread model: posix
gcc version 3.4.5

Output from: gcc-3.4.5 -S on ppc computer (G4)

	.file	"q.f"
	.section	".text"
	.align 2
	.globl qq_
	.type	qq_, @function
qq_:
	stwu 1,-736(1)
	mflr 0
	stw 31,732(1)
	stw 0,740(1)
	mr 31,1
	nop
.L2:
	lwz 0,644(31)
	cmpwi 7,0,0
	bne 7,.L1
	lwz 0,648(31)
	cmpwi 7,0,1
	bne 7,.L1
	lwz 0,652(31)
	cmpwi 7,0,0
	bne 7,.L4
	lis 9,ovrlap_@ha
	lwz 0,ovrlap_@l(9)
	stw 0,656(31)
	lis 9,ovrlap_@ha
	lis 11,ovrlap_+4@ha
	lwz 9,ovrlap_@l(9)
	lwz 0,ovrlap_+4@l(11)
	cmpw 7,9,0
	beq 7,.L5
	li 0,1
	stw 0,652(31)
.L5:
	addi 0,31,664
	addi 9,31,668
	addi 11,31,668
	addi 10,31,668
	mr 3,0
	mr 4,9
	mr 5,11
	mr 6,10
	crxor 6,6,6
	bl match_
	mr 0,3
	stw 0,660(31)
	lwz 0,660(31)
	cmpwi 7,0,0
	bne 7,.L6
	li 0,0
	stw 0,656(31)
	b .L1
.L6:
	lwz 0,660(31)
	cmpwi 7,0,1
	bne 7,.L13
	lwz 0,652(31)
	cmpwi 7,0,1
	bne 7,.L9
	lis 9,ovrlap_@ha
	lwz 0,672(31)
	stw 0,ovrlap_@l(9)
	lis 9,ovrlap_+4@ha
	lwz 0,676(31)
	stw 0,ovrlap_+4@l(9)
	lis 9,ovrlap_+8@ha
	lwz 0,680(31)
	stw 0,ovrlap_+8@l(9)
	lis 9,ovrlap_+12@ha
	lwz 0,684(31)
	stw 0,ovrlap_+12@l(9)
	lis 9,ovrlap_+20@ha
	lwz 0,688(31)
	stw 0,ovrlap_+20@l(9)
	lis 9,ovrlap_+52@ha
	lwz 0,692(31)
	stw 0,ovrlap_+52@l(9)
	lis 9,ovrlap_+56@ha
	lwz 0,696(31)
	stw 0,ovrlap_+56@l(9)
	lis 9,ovrlap_+60@ha
	lwz 0,700(31)
	stw 0,ovrlap_+60@l(9)
	lis 9,ovrlap_+64@ha
	lwz 0,704(31)
	stw 0,ovrlap_+64@l(9)
	b .L10
.L9:
	li 0,0
	stw 0,656(31)
	b .L1
.L4:
	nop
.L10:
	lis 9,ovrlap_+4@ha
	lwz 0,ovrlap_+4@l(9)
	stw 0,656(31)
	lis 9,consts_@ha
	lfs 0,consts_@l(9)
	stfs 0,708(31)
	lis 9,consts_@ha
	lfs 0,consts_@l(9)
	stfs 0,712(31)
	li 0,0
	stw 0,652(31)
	addi 0,31,668
	addi 9,31,664
	addi 11,31,668
	addi 10,31,668
	mr 3,0
	mr 4,9
	mr 5,11
	mr 6,10
	crxor 6,6,6
	bl match_
	mr 0,3
	stw 0,660(31)
	lwz 0,660(31)
	cmpwi 7,0,2
	bne 7,.L15
	b .L13
.L15:
	li 0,0
	stw 0,656(31)
	b .L1
.L13:
	lwz 0,656(31)
	stw 0,716(31)
.L1:
	lwz 11,0(1)
	lwz 0,4(11)
	mtlr 0
	lwz 31,-4(11)
	mr 1,11
	blr
	.size	qq_, .-qq_
	.comm	tensor_,1604,16
	.comm	couple_,776,16
	.comm	inform_,44,16
	.comm	kron_,400,16
	.comm	medefn_,660,16
	.comm	debug_,24,16
	.comm	terms_,1528,16
	.comm	consts_,40,16
	.comm	ovrlap_,84,16
	.comm	ovrint_,24,16
	.comm	machor_,8,16
	.comm	fact_,400,16
	.comm	ems_,28,16
	.section	.note.GNU-stack,"",@progbits
	.ident	"GCC: (GNU) 3.4.5"


Error Message using gcc-4.1.0-20051230

 In file q.f:61

  105       IRHO=NU
    1
 In file q.f:52

                  GO TO 105 ! rmg questionable goto
                                                  2
Error: Label at (1) is not in the same block as the GOTO statement at (2)


Using built-in specs. (for gcc-4.1.0)
Target: powerpc-unknown-linux-gnu
Configured with: ../gcc-4.1-20051230/configure --enable-version-specific-runtime-libs --prefix=/usr
--bindir=/usr/powerpc-unknown-linux-gnu/gcc-bin/4.1.0-beta20051230
--includedir=/usr/lib/gcc/powerpc-unknown-linux-gnu/4.1.0-beta20051230/include
--datadir=/usr/share/gcc-data/powerpc-unknown-linux-gnu/4.1.0-beta20051230
--mandir=/usr/share/gcc-data/powerpc-unknown-linux-gnu/4.1.0-beta20051230/man
--infodir=/usr/share/gcc-data/powerpc-unknown-linux-gnu/4.1.0-beta20051230/info
--with-gxx-include-dir=/usr/lib/gcc/powerpc-unknown-linux-gnu/4.1.0-beta20051230/include/g++-v4
--enable-nls --without-included-gettext --with-system-zlib --disable-checking
--disable-werror --disable-libunwind-exceptions --disable-multilib --enable-languages=all
--enable-shared --enable-threads=posix --enable-__cxa_atexit --enable-clocale=gnu
Thread model: posix
gcc version 4.1.0 20051230 (prerelease)
Comment 1 Ray Malitzke 2006-01-07 00:12:08 UTC
I know that this has no easy solution. However, just stating that this is an (implicitly) inadmissable case of going from one block to another is not satisfactory.  Please PLEASE!!! do not make this into another case for specifications lawyers. What the using community needs are not arguments but continued use of working programs. Rewrites are OK when there are clear advantages in efficiency or less susceptibility to fraudulent use of existing code. 
Comment 2 Andrew Pinski 2006-01-07 00:16:22 UTC
IFC gives a warning:
fortcom: Warning: t.f, line 70: A jump into a block from outside the block may have occurred.   [105]
                  GO TO 105 ! rmg questionable goto
........................^

Oh, this is a dup of bug 18540.  This is really questionable Fortran code.

*** This bug has been marked as a duplicate of 18540 ***

*** This bug has been marked as a duplicate of 18540 ***
Comment 3 Steven Bosscher 2006-01-08 17:35:53 UTC
Re. #1, where you wrote: "What the using community needs are not arguments but
continued use of working programs. Rewrites are OK when there are clear
advantages in efficiency or less susceptibility to fraudulent use of existing
code."

I don't want to get into this whole flame war any more than the others.  But I do want to give you my view on these remarks.

You clearly don't understand why g77 had to be rewritten, and you (and much of the rest of the "using community") also don't understand how GCC development works.  So let me try to explain that first.

If it were not for the efforts of a small number of Fortran *users*, there would not be a gfortran.  I emphasize users here because all of us gfortran developers are Fortran users first, gfortran developers second.

This rewrite has nothing to do with efficiency or improved support for the language.  It was about making Fortran survive as a language supported by GCC.  Most GCC developers don't care about Fortran at all.  And quite understandably so: You get no money but tons of complaints for working on Fortran.  The scientific community is a demanding miser.  C and C++ are still the languages that much of the GCC community makes a living of.  G77 was rotting and holding back GCC development.  If G77 had not been rewritten, Fortran would probably have been dropped as a supported language in GCC 4.0.

The people working on gfortran are Fortran users who understood that Fortran as a language would just be ditched from GCC altogether unless G77 would be rewriten from scratch.  Literally all gfortran hackers are volunteers who don't get a penny for their work.  What this development community does _not_ need is people like you who think it is OK to take our development effort and never contribute back anything other than complaints and insults.  People making comments like yours are only going to make me (as one of the founders of the gfortran project) and others less willing to work on gfortran.

The developers working on gfortran, and on gcc as a whole, try to do the best they can, but manpower is limited and all of us are volunteers.  If what we create is not good enough, accept it and help make it better, or go buy a commercial compiler.