public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/32140]  New: wrong code
@ 2007-05-29 15:03 jv244 at cam dot ac dot uk
  2007-05-29 15:32 ` [Bug fortran/32140] [4.3 Regression] Miscompilation with -O1 burnus at gcc dot gnu dot org
                   ` (28 more replies)
  0 siblings, 29 replies; 30+ messages in thread
From: jv244 at cam dot ac dot uk @ 2007-05-29 15:03 UTC (permalink / raw)
  To: gcc-bugs

The following (reduced from CP2K, PR 29975) generates wrong code with gfortran
(gcc version 4.3.0 20070526)

MODULE TEST
CONTAINS
PURE FUNCTION s2a_3(s1,s2,s3) RESULT(a)
    CHARACTER(LEN=*), INTENT(IN)             :: s1, s2, s3
    CHARACTER(LEN=4), DIMENSION(3)        :: a

  a(1)=s1; a(2)=s2; a(3)=s3
END FUNCTION
END MODULE

USE TEST
write(6,*) s2a_3("a","bb","ccc")
END

gfortran -O0 test.f90
> ./a.out
 a   bb  ccc
> gfortran -O2 test.f90
> ./a.out
 abb  ccc

the latter case also shows:

==21268== Syscall param write(buf) points to uninitialised byte(s)
==21268==    at 0x4FF9CB0: __write_nocancel (in /lib64/libc-2.4.so)
==21268==    by 0x4BB8E10: do_write (unix.c:336)
==21268==    by 0x4BB8EB1: fd_flush (unix.c:386)
==21268==    by 0x4BB9AE7: fd_write (unix.c:761)
==21268==    by 0x4BB65E5: _gfortrani_next_record (transfer.c:2526)
==21268==    by 0x4BB69F5: finalize_transfer (transfer.c:2663)
==21268==    by 0x4BB6A38: _gfortran_st_write_done (transfer.c:2801)
==21268==    by 0x40090D: MAIN__ (in /users/vondele/g95/a.out)
==21268==    by 0x400AEB: main (fmain.c:22)
==21268==  Address 0x517A3CF is 151 bytes inside a block of size 8,344 alloc'd
==21268==    at 0x4A20A56: malloc (vg_replace_malloc.c:149)
==21268==    by 0x4B39518: _gfortrani_get_mem (memory.c:53)
==21268==    by 0x4BB9879: fd_to_stream (unix.c:1043)
==21268==    by 0x4BB86BB: _gfortrani_init_units (unit.c:515)
==21268==    by 0x4B39267: init (main.c:152)
==21268==    by 0x4BC8B61: (within
/data/vondele/gcc_trunk/build/lib64/libgfortran.so.3.0.0)
==21268==    by 0x4B35F8A: (within
/data/vondele/gcc_trunk/build/lib64/libgfortran.so.3.0.0)


-- 
           Summary: wrong code
           Product: gcc
           Version: 4.3.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: jv244 at cam dot ac dot uk


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


^ permalink raw reply	[flat|nested] 30+ messages in thread

end of thread, other threads:[~2007-06-20 14:59 UTC | newest]

Thread overview: 30+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-05-29 15:03 [Bug fortran/32140] New: wrong code jv244 at cam dot ac dot uk
2007-05-29 15:32 ` [Bug fortran/32140] [4.3 Regression] Miscompilation with -O1 burnus at gcc dot gnu dot org
2007-05-29 15:41 ` jv244 at cam dot ac dot uk
2007-05-29 18:09 ` [Bug middle-end/32140] " burnus at gcc dot gnu dot org
2007-05-29 18:15 ` burnus at gcc dot gnu dot org
2007-05-29 18:26 ` pinskia at gcc dot gnu dot org
2007-05-30  9:23 ` jv244 at cam dot ac dot uk
2007-06-03  9:02 ` jv244 at cam dot ac dot uk
2007-06-12 15:47 ` [Bug fortran/32140] " fxcoudert at gcc dot gnu dot org
2007-06-13  0:55 ` jvdelisle at gcc dot gnu dot org
2007-06-15 14:43 ` jv244 at cam dot ac dot uk
2007-06-15 15:12 ` fxcoudert at gcc dot gnu dot org
2007-06-15 15:22 ` pinskia at gmail dot com
2007-06-16 19:04 ` jv244 at cam dot ac dot uk
2007-06-17 17:54 ` pault at gcc dot gnu dot org
2007-06-17 21:40 ` [Bug middle-end/32140] " pinskia at gcc dot gnu dot org
2007-06-17 21:45 ` [Bug fortran/32140] " pinskia at gcc dot gnu dot org
2007-06-17 22:08 ` pinskia at gcc dot gnu dot org
2007-06-18  1:49 ` jvdelisle at gcc dot gnu dot org
2007-06-20  8:48 ` jv244 at cam dot ac dot uk
2007-06-20  8:52 ` fxcoudert at gcc dot gnu dot org
2007-06-20 13:22 ` pinskia at gmail dot com
2007-06-20 13:53 ` rguenth at gcc dot gnu dot org
2007-06-20 13:55 ` rguenth at gcc dot gnu dot org
2007-06-20 14:03 ` jv244 at cam dot ac dot uk
2007-06-20 14:03 ` pinskia at gcc dot gnu dot org
2007-06-20 14:05 ` pinskia at gcc dot gnu dot org
2007-06-20 14:08 ` rguenther at suse dot de
2007-06-20 14:57 ` rguenth at gcc dot gnu dot org
2007-06-20 14:59 ` rguenth at gcc dot gnu dot org

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).