public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug bootstrap/62005] New: [4.10 regression] with --enable-checking=rtl : loop-unroll.c:2095:10: error: function may return address of local variable
@ 2014-08-04  9:13 dimhen at gmail dot com
  2014-08-04  9:53 ` [Bug bootstrap/62005] " rguenth at gcc dot gnu.org
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: dimhen at gmail dot com @ 2014-08-04  9:13 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 62005
           Summary: [4.10 regression] with --enable-checking=rtl :
                    loop-unroll.c:2095:10: error: function may return
                    address of local variable
           Product: gcc
           Version: 4.10.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: bootstrap
          Assignee: unassigned at gcc dot gnu.org
          Reporter: dimhen at gmail dot com

r213523, r213529 FAIL
r213316 PASS

~/src/gcc_r213529/configure --enable-checking=rtl
make
[...]
make[3]: Entering directory `/home/dimhen/build/gcc_r213529_rtl/gcc'
/home/dimhen/build/gcc_r213529_rtl/./prev-gcc/xg++
-B/home/dimhen/build/gcc_r213529_rtl/./prev-gcc/
-B/usr/local/x86_64-unknown-linux-gnu/bin/ -nostdinc++
-B/home/dimhen/build/gcc_r213529_rtl/prev-x86_64-unknown-linux-gnu/libstdc++-v3/src/.libs
-B/home/dimhen/build/gcc_r213529_rtl/prev-x86_64-unknown-linux-gnu/libstdc++-v3/libsupc++/.libs

-I/home/dimhen/build/gcc_r213529_rtl/prev-x86_64-unknown-linux-gnu/libstdc++-v3/include/x86_64-unknown-linux-gnu

-I/home/dimhen/build/gcc_r213529_rtl/prev-x86_64-unknown-linux-gnu/libstdc++-v3/include
 -I/home/dimhen/src/gcc_r213529/libstdc++-v3/libsupc++
-L/home/dimhen/build/gcc_r213529_rtl/prev-x86_64-unknown-linux-gnu/libstdc++-v3/src/.libs
-L/home/dimhen/build/gcc_r213529_rtl/prev-x86_64-unknown-linux-gnu/libstdc++-v3/libsupc++/.libs
-c   -g -O2 -gtoggle -DIN_GCC    -fno-exceptions -fno-rtti
-fasynchronous-unwind-tables -W -Wall -Wno-narrowing -Wwrite-strings
-Wcast-qual -Wmissing-format-attribute -Woverloaded-virtual -pedantic
-Wno-long-long -Wno-variadic-macros -Wno-overlength-strings -Werror  
-DHAVE_CONFIG_H -I. -I. -I/home/dimhen/src/gcc_r213529/gcc
-I/home/dimhen/src/gcc_r213529/gcc/.
-I/home/dimhen/src/gcc_r213529/gcc/../include
-I/home/dimhen/src/gcc_r213529/gcc/../libcpp/include
-I/home/dimhen/build/gcc_r213529_rtl/./gmp -I/home/dimhen/src/gcc_r213529/gmp
-I/home/dimhen/build/gcc_r213529_rtl/./mpfr -I/home/dimhen/src/gcc_r213529/mpfr
-I/home/dimhen/src/gcc_r213529/mpc/src 
-I/home/dimhen/src/gcc_r213529/gcc/../libdecnumber
-I/home/dimhen/src/gcc_r213529/gcc/../libdecnumber/bid -I../libdecnumber
-I/home/dimhen/src/gcc_r213529/gcc/../libbacktrace -DCLOOG_INT_GMP
-I/home/dimhen/build/gcc_r213529_rtl/./cloog/include
-I/home/dimhen/src/gcc_r213529/cloog/include
-I/home/dimhen/build/gcc_r213529_rtl/./isl/include
-I/home/dimhen/src/gcc_r213529/isl/include  -o loop-unroll.o -MT loop-unroll.o
-MMD -MP -MF ./.deps/loop-unroll.TPo
/home/dimhen/src/gcc_r213529/gcc/loop-unroll.c
/home/dimhen/src/gcc_r213529/gcc/loop-unroll.c: In function 'rtx_def**
get_ivts_expr(rtx, iv_to_split*)':
/home/dimhen/src/gcc_r213529/gcc/loop-unroll.c:2095:10: error: function may
return address of local variable [-Werror=return-local-addr]
   return ret;
          ^
/home/dimhen/src/gcc_r213529/gcc/loop-unroll.c:2087:20: note: declared here
 get_ivts_expr (rtx expr, struct iv_to_split *ivts)
                    ^
cc1plus: all warnings being treated as errors
make[3]: *** [loop-unroll.o] Error 1
make[3]: Leaving directory `/home/dimhen/build/gcc_r213529_rtl/gcc'


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

* [Bug bootstrap/62005] [4.10 regression] with --enable-checking=rtl : loop-unroll.c:2095:10: error: function may return address of local variable
  2014-08-04  9:13 [Bug bootstrap/62005] New: [4.10 regression] with --enable-checking=rtl : loop-unroll.c:2095:10: error: function may return address of local variable dimhen at gmail dot com
@ 2014-08-04  9:53 ` rguenth at gcc dot gnu.org
  2014-08-04 10:24 ` glisse at gcc dot gnu.org
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: rguenth at gcc dot gnu.org @ 2014-08-04  9:53 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |glisse at gcc dot gnu.org
   Target Milestone|---                         |4.10.0

--- Comment #1 from Richard Biener <rguenth at gcc dot gnu.org> ---
Hmm, the warning is true if ivts->n_loc == 0.  Marc?


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

* [Bug bootstrap/62005] [4.10 regression] with --enable-checking=rtl : loop-unroll.c:2095:10: error: function may return address of local variable
  2014-08-04  9:13 [Bug bootstrap/62005] New: [4.10 regression] with --enable-checking=rtl : loop-unroll.c:2095:10: error: function may return address of local variable dimhen at gmail dot com
  2014-08-04  9:53 ` [Bug bootstrap/62005] " rguenth at gcc dot gnu.org
@ 2014-08-04 10:24 ` glisse at gcc dot gnu.org
  2014-08-04 18:47 ` jakub at gcc dot gnu.org
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: glisse at gcc dot gnu.org @ 2014-08-04 10:24 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #2 from Marc Glisse <glisse at gcc dot gnu.org> ---
Ah, I didn't test with --enable-ckecking=rtl.

We could split the "maybe" part of the warning and downgrade it to Wextra, but
I'd rather keep it at least in Wall, which means we need to change the
loop-unroll code anyway.

The code is not easy to understand. For instance, I don't see where n_loc can
be set to any value other than 1? That would make it easy to simplify this
loop...


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

* [Bug bootstrap/62005] [4.10 regression] with --enable-checking=rtl : loop-unroll.c:2095:10: error: function may return address of local variable
  2014-08-04  9:13 [Bug bootstrap/62005] New: [4.10 regression] with --enable-checking=rtl : loop-unroll.c:2095:10: error: function may return address of local variable dimhen at gmail dot com
  2014-08-04  9:53 ` [Bug bootstrap/62005] " rguenth at gcc dot gnu.org
  2014-08-04 10:24 ` glisse at gcc dot gnu.org
@ 2014-08-04 18:47 ` jakub at gcc dot gnu.org
  2014-08-04 18:55 ` glisse at gcc dot gnu.org
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: jakub at gcc dot gnu.org @ 2014-08-04 18:47 UTC (permalink / raw)
  To: gcc-bugs

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

Jakub Jelinek <jakub at gcc dot gnu.org> changed:

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

--- Comment #3 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
I've posted a loop-unroll.c fix.

That said, an interesting question is why we don't warn about this without rtl
checking, the function still returns address of the parameter.  Is that because
it is inlined in that case and so we don't warn then?


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

* [Bug bootstrap/62005] [4.10 regression] with --enable-checking=rtl : loop-unroll.c:2095:10: error: function may return address of local variable
  2014-08-04  9:13 [Bug bootstrap/62005] New: [4.10 regression] with --enable-checking=rtl : loop-unroll.c:2095:10: error: function may return address of local variable dimhen at gmail dot com
                   ` (2 preceding siblings ...)
  2014-08-04 18:47 ` jakub at gcc dot gnu.org
@ 2014-08-04 18:55 ` glisse at gcc dot gnu.org
  2014-08-04 20:12 ` glisse at gcc dot gnu.org
  2014-08-05  9:08 ` jakub at gcc dot gnu.org
  5 siblings, 0 replies; 7+ messages in thread
From: glisse at gcc dot gnu.org @ 2014-08-04 18:55 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #4 from Marc Glisse <glisse at gcc dot gnu.org> ---
(In reply to Jakub Jelinek from comment #3)
> That said, an interesting question is why we don't warn about this without
> rtl checking, the function still returns address of the parameter.  Is that
> because it is inlined in that case and so we don't warn then?

That seems likely, RTL checking may make the function large enough not to be
inlined. Compiling without RTL checking but with -fkeep-inline-functions
probably warns as well then.


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

* [Bug bootstrap/62005] [4.10 regression] with --enable-checking=rtl : loop-unroll.c:2095:10: error: function may return address of local variable
  2014-08-04  9:13 [Bug bootstrap/62005] New: [4.10 regression] with --enable-checking=rtl : loop-unroll.c:2095:10: error: function may return address of local variable dimhen at gmail dot com
                   ` (3 preceding siblings ...)
  2014-08-04 18:55 ` glisse at gcc dot gnu.org
@ 2014-08-04 20:12 ` glisse at gcc dot gnu.org
  2014-08-05  9:08 ` jakub at gcc dot gnu.org
  5 siblings, 0 replies; 7+ messages in thread
From: glisse at gcc dot gnu.org @ 2014-08-04 20:12 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #5 from Marc Glisse <glisse at gcc dot gnu.org> ---
(In reply to Marc Glisse from comment #4)
> Compiling without RTL checking but with -fkeep-inline-functions
> probably warns as well then.

Uh, for some reason -fkeep-inline-functions does not preserve static functions,
but it does preserve static inline functions (so it warns if I add "inline" on
the definition of get_ivts_expr). I couldn't find a -fkeep-static-functions.


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

* [Bug bootstrap/62005] [4.10 regression] with --enable-checking=rtl : loop-unroll.c:2095:10: error: function may return address of local variable
  2014-08-04  9:13 [Bug bootstrap/62005] New: [4.10 regression] with --enable-checking=rtl : loop-unroll.c:2095:10: error: function may return address of local variable dimhen at gmail dot com
                   ` (4 preceding siblings ...)
  2014-08-04 20:12 ` glisse at gcc dot gnu.org
@ 2014-08-05  9:08 ` jakub at gcc dot gnu.org
  5 siblings, 0 replies; 7+ messages in thread
From: jakub at gcc dot gnu.org @ 2014-08-05  9:08 UTC (permalink / raw)
  To: gcc-bugs

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

Jakub Jelinek <jakub at gcc dot gnu.org> changed:

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

--- Comment #6 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Author: jakub
Date: Tue Aug  5 08:09:00 2014
New Revision: 213621

URL: https://gcc.gnu.org/viewcvs?rev=213621&root=gcc&view=rev
Log:
    * loop-unroll.c (struct iv_to_split): Remove n_loc and loc fields.
    (analyze_iv_to_split_insn): Don't initialize them.
    (get_ivts_expr): Removed.
    (allocate_basic_variable, insert_base_initialization): Use
    SET_SRC instead of *get_ivts_expr.
    (split_iv): Use &SET_SRC instead of get_ivts_expr.

Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/loop-unroll.c


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

end of thread, other threads:[~2014-08-05  9:08 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-08-04  9:13 [Bug bootstrap/62005] New: [4.10 regression] with --enable-checking=rtl : loop-unroll.c:2095:10: error: function may return address of local variable dimhen at gmail dot com
2014-08-04  9:53 ` [Bug bootstrap/62005] " rguenth at gcc dot gnu.org
2014-08-04 10:24 ` glisse at gcc dot gnu.org
2014-08-04 18:47 ` jakub at gcc dot gnu.org
2014-08-04 18:55 ` glisse at gcc dot gnu.org
2014-08-04 20:12 ` glisse at gcc dot gnu.org
2014-08-05  9:08 ` jakub 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).