[Bug fortran/38437] New: truncation error in endfile

2008-12-07 Thread marbertone at gmail dot com
Hello,
I’ve got this problem…

*
endfile: truncation failed in endfile
apparent state: unit 1 named fort.1
last format: list io
lately writing direct formatted external IO
*
On the file fort.1 I first open it, then read, then close, then write, then
close again…. But this happens randomly and even randomly with the 5 files I
use in my program. The compiler is g77 for windows. On Linux it works perfectly
(w/ gfortran). I really need to fix this problem, could you please suggest me
what I should write inside my code to explain g77 that he should have a good
behavior? :) 

Thanks

Mario Alberto Annunziata


-- 
   Summary: truncation error in endfile
   Product: gcc
   Version: unknown
Status: UNCONFIRMED
  Severity: critical
  Priority: P3
 Component: fortran
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: marbertone at gmail dot com


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



[Bug fortran/38467] New: gfortran builds programs which don't run on Vista

2008-12-09 Thread marbertone at gmail dot com
Hello,
I downloaded gfortran for windows in mingw32 edition. I try to compile a simple
program in fortran (test.f) and it goes ok. Also g77 compiles it, with the
difference that when I try to execute the program compiled with gfortran a
window appear: "Invalid win32 application", then i press ok and the program
stops, on cmd "forbidden access" appears. What should I do?
Thanks


-- 
   Summary: gfortran builds programs which don't run on Vista
   Product: gcc
   Version: unknown
Status: UNCONFIRMED
  Severity: critical
  Priority: P3
 Component: fortran
AssignedTo: unassigned at gcc dot gnu dot org
    ReportedBy: marbertone at gmail dot com


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



[Bug fortran/38467] gfortran builds programs which don't run on Vista

2008-12-11 Thread marbertone at gmail dot com


--- Comment #2 from marbertone at gmail dot com  2008-12-11 16:36 ---
(In reply to comment #1)

a)

GNU Fortran (GCC) 4.4.0 20080603 (experimental) [trunk revision 136333]
Copyright (C) 2008 Free Software Foundation, Inc.

GNU Fortran comes with NO WARRANTY, to the extent permitted by law.
You may redistribute copies of GNU Fortran
under the terms of the GNU General Public License.
For more information about these matters, see the file named COPYING

b)

it doesn't matter, any code, trust me.

c)

cat prova.f:


 IMPLICIT REAL*8 (A-H,O-Z)

 INTEGER I(10), JJ, PP, MASSIMO, FINE, INDMASSIMO, PJ

 I(1)  = 23
 I(2)  = 35
 I(3)  = 48
 I(4)  = 66
 I(5)  = 1
 I(6)  = 4
 I(7)  = 10
 I(8)  = 8
 I(9)  = 6
 I(10) = 2

 DO PJ = 1,10
 print *, 'I(',PJ,') = ',I(PJ)
 ENDDO

 FINE = 10

 DO JJ = 1,9
 MASSIMO = I(1)
 INDMASSIMO = 1
 DO PP = 2, FINE
 IF (I(PP) .GT. MASSIMO) THEN
 MASSIMO = I(PP)
 INDMASSIMO = PP
 ENDIF
 ENDDO
 I(INDMASSIMO) = I(FINE)
 I(FINE) = MASSIMO
 DO PJ = 1,FINE
 print *, 'I(',PJ,') = ',I(PJ)
 ENDDO
 print *, '*'
 FINE = FINE - 1
 ENDDO

 DO PJ = 1,10
 print *, 'I(',PJ,') = ',I(PJ)
 ENDDO

 END

Gfortran (...)

C.\Users\Berto\prg\aov\prova.exe non è un'applicazione di Win32 valida.
[translation: (...) is not a Win32 valid application) (it is a dialog box,
then I press ok and it returns:)

Accesso negato (access denied)


I hope you give me some ideas! ;)

Thanks

> Please ...
>   a) ... specify the version of your compiler (gfortran --version) and 
>  where/how it was obtained
>   b) ... show a self-contained code example
>   c) ... show a log of your actions, something like
> 
> $> cat file.f
> [...]
> $> gfortran -Wall -W -fimplicit-none file.f -o foo.exe
> [...]
> $> foo.exe
> [...]
> 
> where you fill in the [...]
> 


-- 


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



[Bug fortran/38437] truncation error in endfile

2008-12-11 Thread marbertone at gmail dot com


--- Comment #3 from marbertone at gmail dot com  2008-12-11 16:38 ---
(In reply to comment #2)

Hello,
I attach you the problematic lines. Gfortran for windows doesn't work. It
crashes in the two cases (native and cygwin). I repeat, on linux it works
perfectly with gfortran. On Vista it says 'invalid win32 application after
compiling'. I thank you anticipately :)
Mario Alberto


open(file = 'fort.1', unit=1, form = 'formatted')
  DO I = 1,NA
READ (1,*) XA(I),YA(I),ZA(I)
ENDDO
 DO I = 1,NB
 READ (1,*) XB(I),YB(I),ZB(I)
 ENDDO
CLOSE (1)
WRITE(1,*) a, b c
 WRITE(1,*) d, e
 WRITE(1,*) f, g
 WRITE(1,*) a1, a2
 WRITE(1,*) a4, a5, a6
 WRITE(1,*) i1
 DO I = 1,NA
  WRITE (1,*) XA(I),YA(I),ZA(I)
 ENDDO
 DO I = 1,NB
  WRITE (1,*) XB(I),YB(I),ZB(I)
 END
CLOSE(1)
---

> g77 was removed from GCC more than 3.5 years ago and is no longer support.
> 
> However, ask yourself does it make sense to "first open it, then read,
> then close, then write, then close again".  Either re-open the file
> before your write or don't close it.
> 
> PS: why are you using g77 of windows?  Why not use gfortran?
> 


-- 


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



[Bug fortran/38467] gfortran builds programs which don't run on Vista

2008-12-11 Thread marbertone at gmail dot com


--- Comment #5 from marbertone at gmail dot com  2008-12-11 23:37 ---
(In reply to comment #4)
> Add '.exe' to above command lines as you see fit :)

(In reply to comment #3)
> > a) GNU Fortran (GCC) 4.4.0 20080603 (experimental) [trunk revision 136333]
> Ok, but where did you get it from? Compiled from sources, binary package from
> GFortran wiki, something else?
> > b) it doesn't matter, any code, trust me.
> Please try:
> $> cat ctest.c
> #include 
> int main() {
>   printf("C works\n");
>   return 0;
> }
> $> gcc ctest.c -o ctest && ./ctest
> What's the result here?

it works perfectly

> $> cat ftest.f90
>   print *, "fortran works"
> end
> $> gfortran ftest.f90 -o ftest && ./ftest
> What's the result here?

the same as before. , a windows dialog box: "invalid Win32 application". It's a
true pity cause I need it to work on my laptop when I don't have internet
:(

> If neither test works, it's not fortran related. If both tests work, the
> problem is on your side. If either one works but not the other, uhoh.


-- 


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



[Bug fortran/38467] gfortran builds programs which don't run on Vista

2008-12-11 Thread marbertone at gmail dot com


--- Comment #6 from marbertone at gmail dot com  2008-12-11 23:39 ---
(In reply to comment #3)
> > a) GNU Fortran (GCC) 4.4.0 20080603 (experimental) [trunk revision 136333]
> Ok, but where did you get it from? Compiled from sources, binary package from
> GFortran wiki, something else?

excuse me I forgot the first question :)

well, I first downloaded mingw32 which contained gcc and g77 (which works but
creates problems), then I downloaded from gcc wiki the win32 stand alone
gfortran version. Thanks for help


-- 


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



[Bug fortran/38467] gfortran builds programs which don't run on Vista

2008-12-13 Thread marbertone at gmail dot com


--- Comment #8 from marbertone at gmail dot com  2008-12-13 16:59 ---
Thanks for the 'shot in the dark' suggestion: it worked!

Great, man!

;) 

Thank you

Mario Alberto



(In reply to comment #7)
> $> gcc --version
> shows the same as gfortran? 
> My only data point is, that I have seen programs that I compiled myself on XP
> run on Vista, so I know that *something* works.
> Would it be possible that there is some library interference?! I believe, you
> don't need a mingw installation for the packages from the wiki. Shot in the
> dark: try deinstalling both and install only the wiki-package (while at it,
> check for updates :) - then try again.


-- 


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