public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/52921] New: Memory errors when compiled with -fstrict-overflow flag
@ 2012-04-10  2:13 alipasha.celeris at gmail dot com
  2012-04-10 11:42 ` [Bug fortran/52921] With realloc-lhs: Conditional jump or move depends on uninitialised value burnus at gcc dot gnu.org
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: alipasha.celeris at gmail dot com @ 2012-04-10  2:13 UTC (permalink / raw)
  To: gcc-bugs

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

             Bug #: 52921
           Summary: Memory errors when compiled with -fstrict-overflow
                    flag
    Classification: Unclassified
           Product: gcc
           Version: 4.8.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: alipasha.celeris@gmail.com


The following test code generates memory errors (valgrind : "Conditional jump
or move depends on uninitialised value(s)") when assigning the values to %CMP
components without allocating it first, if it is compiled with flag
-fstrict-overflow.

      PROGRAM QUICK_TEST

      TYPE COMP
        INTEGER, ALLOCATABLE :: CMP(:)
      END TYPE COMP
      TYPE COMP_ARRAY
        TYPE (COMP), ALLOCATABLE :: ARR(:)
      END TYPE COMP_ARRAY

      INTEGER :: I
      TYPE (COMP_ARRAY), TARGET :: MY_ARR

      READ *, I
      ALLOCATE (MY_ARR%ARR(I))
      MY_ARR%ARR(I)%CMP = [1, 2]

      END PROGRAM QUICK_TEST

However, if "READ *, I" is replaced with "I = 10", i.e. allocation size and the
array index are known at compile time, then no memory errors are generated.

Furthermore, this flag is included in -O3 optimization flag, but it is not
shown when compiling with -Q --help=optimizers .


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

* [Bug fortran/52921] With realloc-lhs: Conditional jump or move depends on uninitialised value
  2012-04-10  2:13 [Bug fortran/52921] New: Memory errors when compiled with -fstrict-overflow flag alipasha.celeris at gmail dot com
@ 2012-04-10 11:42 ` burnus at gcc dot gnu.org
  2015-04-18  9:41 ` mikael at gcc dot gnu.org
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: burnus at gcc dot gnu.org @ 2012-04-10 11:42 UTC (permalink / raw)
  To: gcc-bugs

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

Tobias Burnus <burnus at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
           Keywords|                            |wrong-code
   Last reconfirmed|                            |2012-04-10
                 CC|                            |burnus at gcc dot gnu.org,
                   |                            |pault at gcc dot gnu.org
     Ever Confirmed|0                           |1
            Summary|Memory errors when compiled |With realloc-lhs:
                   |with -fstrict-overflow flag |Conditional jump or move
                   |                            |depends on uninitialised
                   |                            |value

--- Comment #1 from Tobias Burnus <burnus at gcc dot gnu.org> 2012-04-10 11:42:07 UTC ---
I already get the valgrind warning
   Conditional jump or move depends on uninitialised value(s)
for
        MY_ARR%ARR(I)%CMP = [1, 2]
even without any optimization.

(I replaced the READ by an assignment and marked "i" as VOLATILE.)


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

* [Bug fortran/52921] With realloc-lhs: Conditional jump or move depends on uninitialised value
  2012-04-10  2:13 [Bug fortran/52921] New: Memory errors when compiled with -fstrict-overflow flag alipasha.celeris at gmail dot com
  2012-04-10 11:42 ` [Bug fortran/52921] With realloc-lhs: Conditional jump or move depends on uninitialised value burnus at gcc dot gnu.org
@ 2015-04-18  9:41 ` mikael at gcc dot gnu.org
  2015-04-18  9:59 ` dominiq at lps dot ens.fr
  2015-08-07 21:59 ` mikael at gcc dot gnu.org
  3 siblings, 0 replies; 5+ messages in thread
From: mikael at gcc dot gnu.org @ 2015-04-18  9:41 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=52921

Mikael Morin <mikael at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |mikael at gcc dot gnu.org

--- Comment #2 from Mikael Morin <mikael at gcc dot gnu.org> ---
(In reply to Tobias Burnus from comment #1)
> I already get the valgrind warning
>    Conditional jump or move depends on uninitialised value(s)
> for
>         MY_ARR%ARR(I)%CMP = [1, 2]
> even without any optimization.
> 
> (I replaced the READ by an assignment and marked "i" as VOLATILE.)

No error here using the following program; FIXED?

      PROGRAM QUICK_TEST

      TYPE COMP
        INTEGER, ALLOCATABLE :: CMP(:)
      END TYPE COMP
      TYPE COMP_ARRAY
        TYPE (COMP), ALLOCATABLE :: ARR(:)
      END TYPE COMP_ARRAY

      INTEGER, VOLATILE :: I
      TYPE (COMP_ARRAY), TARGET :: MY_ARR

      I=10
      ALLOCATE (MY_ARR%ARR(I))
      MY_ARR%ARR(I)%CMP = [1, 2]

      END PROGRAM QUICK_TEST


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

* [Bug fortran/52921] With realloc-lhs: Conditional jump or move depends on uninitialised value
  2012-04-10  2:13 [Bug fortran/52921] New: Memory errors when compiled with -fstrict-overflow flag alipasha.celeris at gmail dot com
  2012-04-10 11:42 ` [Bug fortran/52921] With realloc-lhs: Conditional jump or move depends on uninitialised value burnus at gcc dot gnu.org
  2015-04-18  9:41 ` mikael at gcc dot gnu.org
@ 2015-04-18  9:59 ` dominiq at lps dot ens.fr
  2015-08-07 21:59 ` mikael at gcc dot gnu.org
  3 siblings, 0 replies; 5+ messages in thread
From: dominiq at lps dot ens.fr @ 2015-04-18  9:59 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=52921

--- Comment #3 from Dominique d'Humieres <dominiq at lps dot ens.fr> ---
> No error here using the following program; FIXED?

I cannot reproduce the problem with 4.8.4 and more recent versions.


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

* [Bug fortran/52921] With realloc-lhs: Conditional jump or move depends on uninitialised value
  2012-04-10  2:13 [Bug fortran/52921] New: Memory errors when compiled with -fstrict-overflow flag alipasha.celeris at gmail dot com
                   ` (2 preceding siblings ...)
  2015-04-18  9:59 ` dominiq at lps dot ens.fr
@ 2015-08-07 21:59 ` mikael at gcc dot gnu.org
  3 siblings, 0 replies; 5+ messages in thread
From: mikael at gcc dot gnu.org @ 2015-08-07 21:59 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=52921

Mikael Morin <mikael at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|---                         |FIXED

--- Comment #4 from Mikael Morin <mikael at gcc dot gnu.org> ---
(In reply to Dominique d'Humieres from comment #3)
> > No error here using the following program; FIXED?
> 
> I cannot reproduce the problem with 4.8.4 and more recent versions.

Closing as FIXED.


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

end of thread, other threads:[~2015-08-07 21:59 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-04-10  2:13 [Bug fortran/52921] New: Memory errors when compiled with -fstrict-overflow flag alipasha.celeris at gmail dot com
2012-04-10 11:42 ` [Bug fortran/52921] With realloc-lhs: Conditional jump or move depends on uninitialised value burnus at gcc dot gnu.org
2015-04-18  9:41 ` mikael at gcc dot gnu.org
2015-04-18  9:59 ` dominiq at lps dot ens.fr
2015-08-07 21:59 ` mikael at gcc dot gnu.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).