public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/27589]  New: Add compiler flag to check for uninitalized values at runtime
@ 2006-05-13 14:12 tobias dot burnus at physik dot fu-berlin dot de
  2006-05-13 14:17 ` [Bug fortran/27589] " tobias dot burnus at physik dot fu-berlin dot de
                   ` (4 more replies)
  0 siblings, 5 replies; 7+ messages in thread
From: tobias dot burnus at physik dot fu-berlin dot de @ 2006-05-13 14:12 UTC (permalink / raw)
  To: gcc-bugs

Currently, gfortran does not seem to have any option to catch uninitialized
variables at run time.

Example (from http://www.polyhedron.com/pb05/linux/diagnose.html):
--------<UNIN1>------------
        program uin1
        integer x,y,a,b
        x=y
        a=b
        print *,x,a
        b=1
        end
---------------------------

Other compilers have an options to catch those, e.g.:

ifort64-9.1 -C -check all -warn all,nodec,interfaces -gen_interfaces -traceback
-fpe0 -fpstkchk UIN1.F
./a.out
forrtl: severe (193): Run-Time Check Failure. The variable 'uin1_$Y' is being
used without being defined

NAG: f95 -C=all -C=undefined -info -g -gline UIN1.F
./a.out
Reference to undefined variable Y
Program terminated by fatal error
In UIN1, line 5 of UIN1.F


-- 
           Summary: Add compiler flag to check for uninitalized values at
                    runtime
           Product: gcc
           Version: 4.2.0
            Status: UNCONFIRMED
          Severity: enhancement
          Priority: P3
         Component: fortran
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: tobias dot burnus at physik dot fu-berlin dot de


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


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

* [Bug fortran/27589] Add compiler flag to check for uninitalized values at runtime
  2006-05-13 14:12 [Bug fortran/27589] New: Add compiler flag to check for uninitalized values at runtime tobias dot burnus at physik dot fu-berlin dot de
@ 2006-05-13 14:17 ` tobias dot burnus at physik dot fu-berlin dot de
  2007-03-22 22:20 ` burnus at gcc dot gnu dot org
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 7+ messages in thread
From: tobias dot burnus at physik dot fu-berlin dot de @ 2006-05-13 14:17 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from tobias dot burnus at physik dot fu-berlin dot de  2006-05-13 14:17 -------
Post scriptum: In this case, using -Wuninitialized -O
the compiler detects that the variable is uninitialized; however, for the other
UIN*.FOR examples at polyhdron.com they are not detected at compile-time.


-- 


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


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

* [Bug fortran/27589] Add compiler flag to check for uninitalized values at runtime
  2006-05-13 14:12 [Bug fortran/27589] New: Add compiler flag to check for uninitalized values at runtime tobias dot burnus at physik dot fu-berlin dot de
  2006-05-13 14:17 ` [Bug fortran/27589] " tobias dot burnus at physik dot fu-berlin dot de
@ 2007-03-22 22:20 ` burnus at gcc dot gnu dot org
  2007-04-18  6:15 ` fxcoudert at gcc dot gnu dot org
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 7+ messages in thread
From: burnus at gcc dot gnu dot org @ 2007-03-22 22:20 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #2 from burnus at gcc dot gnu dot org  2007-03-22 22:20 -------
There are actually two run-time tests possible:

a) Check only local variables
(What to do about actual arguments to intent(in) dummy arguments? In the most
cases this is wrong, however foo(read_argument=.false.,arg=uninitialized) is
possible. Better don't check - or only optionally.)
This seems to be done by ifort's -check uninit.

b) Checking all calls, i.e. by passing additional information. This is done by
NAG f95's -C=undefined. This is more comprehensive, but makes procedures
compiled -C=undefined incompatible to those compiled without.

Ideally, gfortran should offer both options.


-- 


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


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

* [Bug fortran/27589] Add compiler flag to check for uninitalized values at runtime
  2006-05-13 14:12 [Bug fortran/27589] New: Add compiler flag to check for uninitalized values at runtime tobias dot burnus at physik dot fu-berlin dot de
  2006-05-13 14:17 ` [Bug fortran/27589] " tobias dot burnus at physik dot fu-berlin dot de
  2007-03-22 22:20 ` burnus at gcc dot gnu dot org
@ 2007-04-18  6:15 ` fxcoudert at gcc dot gnu dot org
  2007-06-21 16:58 ` burnus at gcc dot gnu dot org
  2007-06-22 13:15 ` burnus at gcc dot gnu dot org
  4 siblings, 0 replies; 7+ messages in thread
From: fxcoudert at gcc dot gnu dot org @ 2007-04-18  6:15 UTC (permalink / raw)
  To: gcc-bugs



-- 

fxcoudert at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|0                           |1
   Last reconfirmed|0000-00-00 00:00:00         |2007-04-18 07:14:46
               date|                            |


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


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

* [Bug fortran/27589] Add compiler flag to check for uninitalized values at runtime
  2006-05-13 14:12 [Bug fortran/27589] New: Add compiler flag to check for uninitalized values at runtime tobias dot burnus at physik dot fu-berlin dot de
                   ` (2 preceding siblings ...)
  2007-04-18  6:15 ` fxcoudert at gcc dot gnu dot org
@ 2007-06-21 16:58 ` burnus at gcc dot gnu dot org
  2007-06-22 13:15 ` burnus at gcc dot gnu dot org
  4 siblings, 0 replies; 7+ messages in thread
From: burnus at gcc dot gnu dot org @ 2007-06-21 16:58 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #3 from burnus at gcc dot gnu dot org  2007-06-21 16:58 -------
Dump a valid program which contains equivalence to show a harder case for the
checks (NAG f95 chokes on it).

      program main
      implicit none
      integer :: i, it, jt
      real    :: tt
      equivalence    (jt,tt)
      dimension it(10)
      do i=1,10
        tt=i
        print *, tt, jt
        it(i)=jt
      end do
      end


-- 


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


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

* [Bug fortran/27589] Add compiler flag to check for uninitalized values at runtime
  2006-05-13 14:12 [Bug fortran/27589] New: Add compiler flag to check for uninitalized values at runtime tobias dot burnus at physik dot fu-berlin dot de
                   ` (3 preceding siblings ...)
  2007-06-21 16:58 ` burnus at gcc dot gnu dot org
@ 2007-06-22 13:15 ` burnus at gcc dot gnu dot org
  4 siblings, 0 replies; 7+ messages in thread
From: burnus at gcc dot gnu dot org @ 2007-06-22 13:15 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #4 from burnus at gcc dot gnu dot org  2007-06-22 13:15 -------
(In reply to comment #3)
> Dump a valid program which contains equivalence to show a harder case for the
> checks (NAG f95 chokes on it).
Actually this is wrong according to the Section 16.5.6 of the F2003 standard:
"When a variable of a given type becomes defined, all associated
variables of different type become undefined."  There then follows an
exception that allows REAL and COMPLEX to be equivalenced and not
be undefined in this circumstance.
Thus one should check for this as well (but having a note in the documentation
for this case would make sense too.)


-- 


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


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

* [Bug fortran/27589] Add compiler flag to check for uninitalized values at runtime
       [not found] <bug-27589-4@http.gcc.gnu.org/bugzilla/>
@ 2021-04-09 17:16 ` msebor at gcc dot gnu.org
  0 siblings, 0 replies; 7+ messages in thread
From: msebor at gcc dot gnu.org @ 2021-04-09 17:16 UTC (permalink / raw)
  To: gcc-bugs

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

Martin Sebor <msebor at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Blocks|24639                       |
                 CC|                            |msebor at gcc dot gnu.org

--- Comment #5 from Martin Sebor <msebor at gcc dot gnu.org> ---
Runtime checking isn't the job of -Wuninitialized so removing the dependency on
the meta bug pr27589.


Referenced Bugs:

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=24639
[Bug 24639] [meta-bug] bug to track all Wuninitialized issues

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

end of thread, other threads:[~2021-04-09 17:16 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-05-13 14:12 [Bug fortran/27589] New: Add compiler flag to check for uninitalized values at runtime tobias dot burnus at physik dot fu-berlin dot de
2006-05-13 14:17 ` [Bug fortran/27589] " tobias dot burnus at physik dot fu-berlin dot de
2007-03-22 22:20 ` burnus at gcc dot gnu dot org
2007-04-18  6:15 ` fxcoudert at gcc dot gnu dot org
2007-06-21 16:58 ` burnus at gcc dot gnu dot org
2007-06-22 13:15 ` burnus at gcc dot gnu dot org
     [not found] <bug-27589-4@http.gcc.gnu.org/bugzilla/>
2021-04-09 17:16 ` msebor 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).