* -O compiling mixed language code seg faults @ 1998-02-01 15:08 Robert Williams 1998-02-01 17:29 ` Jeffrey A Law 0 siblings, 1 reply; 4+ messages in thread From: Robert Williams @ 1998-02-01 15:08 UTC (permalink / raw) To: egcs list, goto System: egcs-980122, axp/RedHat-5.0, 2.1.82 kernel A main Fortran program that calls a C language subroutine (via an archive library...C code calls assembler routine in same library) seg-faults when compiled with the -O option. It works fine when compiled with -g , or with -g -O2 (or O3). Working executables are produced with any -On link option. Looks like a bug. -- Bob Williams, http://bob.usuf2.usuhs.mil/ ^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: -O compiling mixed language code seg faults 1998-02-01 15:08 -O compiling mixed language code seg faults Robert Williams @ 1998-02-01 17:29 ` Jeffrey A Law 1998-02-01 19:45 ` Robert Williams 0 siblings, 1 reply; 4+ messages in thread From: Jeffrey A Law @ 1998-02-01 17:29 UTC (permalink / raw) To: Robert Williams; +Cc: egcs list, goto In message < 34D5009C.412EAD18@bob.usuf2.usuhs.mil >you write: > System: egcs-980122, axp/RedHat-5.0, 2.1.82 kernel > > A main Fortran program that calls a C language subroutine > (via an archive library...C code calls assembler routine in same > library) > seg-faults when compiled with the -O option. > It works fine when compiled with -g , or with -g -O2 (or O3). > Working executables are produced with any -On link option. > Looks like a bug. Actually, from the description it could just as easily be a bug in your code. You will need to debug it to find out for sure. jeff ^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: -O compiling mixed language code seg faults 1998-02-01 17:29 ` Jeffrey A Law @ 1998-02-01 19:45 ` Robert Williams 1998-02-02 10:32 ` Dave Love 0 siblings, 1 reply; 4+ messages in thread From: Robert Williams @ 1998-02-01 19:45 UTC (permalink / raw) To: law; +Cc: egcs list, goto Jeffrey A Law wrote: > In message < 34D5009C.412EAD18@bob.usuf2.usuhs.mil >you write: > > System: egcs-980122, axp/RedHat-5.0, 2.1.82 kernel > > > > A main Fortran program that calls a C language subroutine > > (via an archive library...C code calls assembler routine in same > > library) > > seg-faults when compiled with the -O option. > > It works fine when compiled with -g , or with -g -O2 (or O3). > > Working executables are produced with any -On link option. > > Looks like a bug. > Actually, from the description it could just as easily be a bug > in your code. You will need to debug it to find out for sure. The segmentation fault always occurs here, at "B( I, J ) = LOG(FLOAT(J)) " below. gdb (under ddd) reports that there is no "xlog" or "xlogfloat" symbol in the current context, and a gdb display of local variables does not contain "xlog" and "xlogfloat". "xfloat" does show up in gdb, and ddd. I've added the lines in lower case to help debugging because the debugger will not show these variables. The print statement does show values for these variables as expected. DO 40 J = 1, NCOLB DO 30 I = 1, NROWB xfloat=float(j) xlog=log(xfloat) xlogfloat=log(float(j)) * print *,'i=',i,' j=',j,' float(j)=', * & xfloat,' log(float(j))=', xlog, * & ' xlogfloat=',xlogfloat B( I, J ) = LOG(FLOAT(J)) 30 CONTINUE 40 CONTINUE This Fortran code is stable and has been working well for many years under other compilers. B is dimensioned 2000x2000, but the seg-fault occurs long before those limits are reached, at j=1 and i=1 during the second execution of this block( i and j have already iterated 1-500 and are now going 1-1000. That's all I can do for now. -- Bob Williams, http://bob.usuf2.usuhs.mil/ ^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: -O compiling mixed language code seg faults 1998-02-01 19:45 ` Robert Williams @ 1998-02-02 10:32 ` Dave Love 0 siblings, 0 replies; 4+ messages in thread From: Dave Love @ 1998-02-02 10:32 UTC (permalink / raw) To: egcs >>>>> "Robert" == Robert Williams <bob@bob.usuf2.usuhs.mil> writes: Robert> This Fortran code is stable and has been working well for Robert> many years under other compilers. Without wishing to be unhelpful, that cuts little ice, I'm afraid. I don't have a good idea what the problem is most likely to be in this case but a compiler bug isn't obvious. -- Although my name means "the man of steel" in Swedish, unfortunately I do not have x-ray vision. -- rms ^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~1998-02-02 10:32 UTC | newest] Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 1998-02-01 15:08 -O compiling mixed language code seg faults Robert Williams 1998-02-01 17:29 ` Jeffrey A Law 1998-02-01 19:45 ` Robert Williams 1998-02-02 10:32 ` Dave Love
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).