public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/49617] New: gcc misses uninititialized variables in contained functions
@ 2011-07-03 10:06 pault at gcc dot gnu.org
  2011-07-04  9:49 ` [Bug c/49617] " rguenth at gcc dot gnu.org
  2023-05-20  4:10 ` [Bug middle-end/49617] " pinskia at gcc dot gnu.org
  0 siblings, 2 replies; 3+ messages in thread
From: pault at gcc dot gnu.org @ 2011-07-03 10:06 UTC (permalink / raw)
  To: gcc-bugs

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

           Summary: gcc misses uninititialized variables in contained
                    functions
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: pault@gcc.gnu.org


This was reported to the gfortran list by Bill Paxton:

gfortran test_uninit.f -O2 -Wall -o test; ./test


     module test_mod
     implicit none

     contains

     subroutine test
        integer :: x, y
        call t
        write(*,*) 'y', y

        contains

        subroutine t
        y = x * 5
        end subroutine t

     end subroutine test

     end module test_mod


     program test_uninit
     use test_mod
     implicit none
     call test
     end program test_uninit

No warning is given that 'x' is used uninitialized in subroutine 't'.

The uninitialized checking is done in tree-ssa.c and tree-ssa-uninit.c, so this
should be attributed to gcc.

Tobias Burnus produced this (using gcc extension) testcase in C

int
main (void)
{
 int y;

 int func(void)
 {
   int x;
   /*int z;*/

   x = y;
   /* x = z;*/
   return x;
 }
 return func();
}

This also fails to report on the state of y, when used in 'func'.

I understand that fixing this will not be straightforward but have submitted it
for the record at least.

Paul


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

* [Bug c/49617] gcc misses uninititialized variables in contained functions
  2011-07-03 10:06 [Bug c/49617] New: gcc misses uninititialized variables in contained functions pault at gcc dot gnu.org
@ 2011-07-04  9:49 ` rguenth at gcc dot gnu.org
  2023-05-20  4:10 ` [Bug middle-end/49617] " pinskia at gcc dot gnu.org
  1 sibling, 0 replies; 3+ messages in thread
From: rguenth at gcc dot gnu.org @ 2011-07-04  9:49 UTC (permalink / raw)
  To: gcc-bugs

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

Richard Guenther <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |diagnostic
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2011.07.04 09:48:32
     Ever Confirmed|0                           |1
           Severity|normal                      |enhancement

--- Comment #1 from Richard Guenther <rguenth at gcc dot gnu.org> 2011-07-04 09:48:32 UTC ---
This is similar to other uninitialized reports in that it requires to track
memory.  OTOH it is a lot harder because it is an IPA uninitialized use.


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

* [Bug middle-end/49617] gcc misses uninititialized variables in contained functions
  2011-07-03 10:06 [Bug c/49617] New: gcc misses uninititialized variables in contained functions pault at gcc dot gnu.org
  2011-07-04  9:49 ` [Bug c/49617] " rguenth at gcc dot gnu.org
@ 2023-05-20  4:10 ` pinskia at gcc dot gnu.org
  1 sibling, 0 replies; 3+ messages in thread
From: pinskia at gcc dot gnu.org @ 2023-05-20  4:10 UTC (permalink / raw)
  To: gcc-bugs

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

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Last reconfirmed|2011-07-04 09:48:32         |2023-5-19
          Component|c                           |middle-end

--- Comment #2 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Hmm, for the C testcase with GCC 5, we do get a warning:

<source>: In function 'main':
<source>:11:6: warning: 'FRAME.0.y' is used uninitialized in this function
[-Wuninitialized]
    x = y;
      ^

There is no warning in GCC 6+ though.

Plus the diagnostic mentions FRAME.0. which is not in the original source.

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

end of thread, other threads:[~2023-05-20  4:10 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-07-03 10:06 [Bug c/49617] New: gcc misses uninititialized variables in contained functions pault at gcc dot gnu.org
2011-07-04  9:49 ` [Bug c/49617] " rguenth at gcc dot gnu.org
2023-05-20  4:10 ` [Bug middle-end/49617] " pinskia 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).