Multiple issues with Sun Studio Express December 2006 Build

At comp.lang.fortran, Bob Corbett asked to report issues with SSX3 in this forum. Here we go:

The code example below triggers three (3) different errors in sunf95, but not with Intel, GNU or Lahey compilers.

a) Compile as-is. The result should be 1.0 but the binary crashes with a segmentation fault. The reason: it seems that array x is not passed correctly from SD to MEAN (implied by the array size in mean which is unequal 3).

$> sunf95 -g -w3 -ansi ssx3.f90 && ./a.out

size in sd: 3

size in mean: 1073741824

Segmentation fault

b) Uncomment the USE statement in line 11. Intel and GNU compilers report, that it's not possible to USE a module while compiling it, sunf95 reports an ICE.

$> sunf95 -g -w3 -ansi ssx3.f90

"sunf95.f90", Line = 25, Column = 1: INTERNAL: Interrupt: Segmentation fault

c) Uncomment the interface declaration from line 14-19. Intel, GNU and sunf95 compile this alike, all three report an undefined reference to mean_, but with sunf95 there is also a dwarf error:

$> sunf95 -g -w3 -ansi ssx3.f90

/usr/bin/ld: Dwarf Error: mangled line number section.

sunf95.o: In function `math.sd_':

sunf95.f90:(.text+0x1bc): undefined reference to `mean_'

Regards

Daniel

The code:

$> cat ssx3.f90

MODULE math

CONTAINS

FUNCTION mean(x)

REAL, DIMENSION(:), INTENT(in) :: x

REAL:: mean

WRITE(*,*)"size in mean:", size(x)

mean = sum(x)/size(x)

END FUNCTION

FUNCTION sd(x)

!USE math, ONLY: mean ! uncommentfor ICE

! uncommentfor"/usr/bin/ld: Dwarf Error: mangled line number section."

!INTERFACE

!FUNCTION mean(x)

! REAL, DIMENSION(:), INTENT(in) :: x

! REAL:: mean

!END FUNCTION

!END INTERFACE

REAL, DIMENSION(:), INTENT(in) :: x

REAL:: sd

WRITE(*,*)"size in sd:", size(x)

sd = SQRT(SUM((x - mean(x))**2) / DBLE(size(x) - 1))

END FUNCTION

END MODULE

PROGRAM test_sd

USE math

REAL, DIMENSION(3) :: x = (/ 1.0, 2.0, 3.0 /)

WRITE(*,*) sd(x)

END PROGRAM

[2321 byte] By [dfrankea] at [2007-11-26 14:40:30]
# 1
This IS the right forum to post such issues?If not, shall they be submitted to the bug database at http://bugs.sun.com/services/bugreport/start_form.jsp?
dfrankea at 2007-7-8 8:21:49 > top of Java-index,Development Tools,Solaris and Linux Development Tools...
# 2
You can use this forum to report problems or ask questions about Sun Studio on Linux.You can also report specific bugs such as these at bugs.sun.com, where they will get the attention of the appropriate group within Sun.
clamage45a at 2007-7-8 8:21:49 > top of Java-index,Development Tools,Solaris and Linux Development Tools...
# 3
I forwarded this to the fortran group. A bug has been filed (6512478).I marked the bug to be public today, so in a day or two it should be visiblefor searching on bugs.sun.com
ChrisQuenellea at 2007-7-8 8:21:49 > top of Java-index,Development Tools,Solaris and Linux Development Tools...
# 4
Chris, ten days later, there is still no-such-bug at http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6512478 ?!
dfrankea at 2007-7-8 8:21:49 > top of Java-index,Development Tools,Solaris and Linux Development Tools...
# 5

I added the "jdcinclude" keyword on 1/12 which is supposed to make the

bug public within two days. It seems to be "stuck" somehow. I filed

an internal issuezilla report with the bugs.sun.com support group.

The issuezilla number is 2201. If you're inside Sun, you can check

the status here:

http://seato.sfbay/bugzilla/show_bug.cgi?id=2201

-

Here is the evaluation from the bug:

The problem here is that in the expression

sd = SQRT(SUM((x - mean(x))**2) / DBLE(size(x) - 1))

mean(x) is not canonicalized and therefore mistakenly scalarized.

ChrisQuenellea at 2007-7-8 8:21:49 > top of Java-index,Development Tools,Solaris and Linux Development Tools...