public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug debug/49888] New: VTA: -O2 -g variable value changes, it does not change in the source
@ 2011-07-28 18:04 jan.kratochvil at redhat dot com
  2012-05-23  9:36 ` [Bug debug/49888] " aoliva at gcc dot gnu.org
                   ` (11 more replies)
  0 siblings, 12 replies; 13+ messages in thread
From: jan.kratochvil at redhat dot com @ 2011-07-28 18:04 UTC (permalink / raw)
  To: gcc-bugs

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

           Summary: VTA: -O2 -g variable value changes, it does not change
                    in the source
           Product: gcc
           Version: 4.7.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: debug
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: jan.kratochvil@redhat.com
                CC: aoliva@gcc.gnu.org
            Target: x86_64-unknown-linux-gnu


static int v;
static void __attribute__((noinline, noclone))
f (int *p)
{
  int c = *p;
  v = c;
  *p = 2;
  v = 0; /* break-here */
}
int
main ()
{
  int v = 2;
  f (&v);
  return 0;
}
--------------------------------------------------------------------------------
FAIL: gcc (GCC) 4.5.4 20110728 (prerelease)
FAIL: gcc (GCC) 4.6.2 20110728 (prerelease)
FAIL: gcc (GCC) 4.7.0 20110728 (experimental)
-Wall -g -O2
--------------------------------------------------------------------------------
Breakpoint 1, f (p=0x7fffffffda44) at 8.c:7
7      *p = 2;
(gdb) disass
Dump of assembler code for function f:
=> 0x0000000000400480 <+0>:    movl   $0x2,(%rdi)
   0x0000000000400486 <+6>:    movl   $0x0,0x2003e8(%rip)        # 0x600878 <v>
   0x0000000000400490 <+16>:    retq   
End of assembler dump.
(gdb) p c
$1 = 1
(gdb) stepi
8      v = 0; /* break-here */
(gdb) p c

Actual:
$2 = 2
Expected:
$2 = 1

`c' is never changed in the source code, it should not change in runtime.
    <63>   DW_AT_location    : 2 byte block: 75 0       (DW_OP_breg5 (rdi): 0)

<optimized out> would be better than a wrong value.


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

* [Bug debug/49888] VTA: -O2 -g variable value changes, it does not change in the source
  2011-07-28 18:04 [Bug debug/49888] New: VTA: -O2 -g variable value changes, it does not change in the source jan.kratochvil at redhat dot com
@ 2012-05-23  9:36 ` aoliva at gcc dot gnu.org
  2012-06-13 21:44 ` aoliva at gcc dot gnu.org
                   ` (10 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: aoliva at gcc dot gnu.org @ 2012-05-23  9:36 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #1 from Alexandre Oliva <aoliva at gcc dot gnu.org> 2012-05-23 09:30:29 UTC ---
Patch at http://gcc.gnu.org/ml/gcc-patches/2012-05/msg01546.html


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

* [Bug debug/49888] VTA: -O2 -g variable value changes, it does not change in the source
  2011-07-28 18:04 [Bug debug/49888] New: VTA: -O2 -g variable value changes, it does not change in the source jan.kratochvil at redhat dot com
  2012-05-23  9:36 ` [Bug debug/49888] " aoliva at gcc dot gnu.org
@ 2012-06-13 21:44 ` aoliva at gcc dot gnu.org
  2012-06-13 21:58 ` aoliva at gcc dot gnu.org
                   ` (9 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: aoliva at gcc dot gnu.org @ 2012-06-13 21:44 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #2 from Alexandre Oliva <aoliva at gcc dot gnu.org> 2012-06-13 21:43:54 UTC ---
Author: aoliva
Date: Wed Jun 13 21:43:51 2012
New Revision: 188531

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=188531
Log:
gcc/ChangeLog:
PR debug/49888
* var-tracking.c: Include alias.h.
(overlapping_mems): New struct.
(drop_overlapping_mem_locs): New.
(clobber_overlapping_mems): New.
(var_mem_delete_and_set, var_mem_delete): Call it.
(val_bind): Likewise, but only if modified.
(compute_bb_dataflow, emit_notes_in_bb): Call it on MEMs.
* Makefile.in (var-tracking.o): Depend in $(ALIAS_H).
gcc/testsuite/ChangeLog:
PR debug/49888
* gcc.dg/guality/pr49888.c: New.

Added:
    trunk/gcc/testsuite/gcc.dg/guality/pr49888.c
Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/Makefile.in
    trunk/gcc/testsuite/ChangeLog
    trunk/gcc/var-tracking.c


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

* [Bug debug/49888] VTA: -O2 -g variable value changes, it does not change in the source
  2011-07-28 18:04 [Bug debug/49888] New: VTA: -O2 -g variable value changes, it does not change in the source jan.kratochvil at redhat dot com
  2012-05-23  9:36 ` [Bug debug/49888] " aoliva at gcc dot gnu.org
  2012-06-13 21:44 ` aoliva at gcc dot gnu.org
@ 2012-06-13 21:58 ` aoliva at gcc dot gnu.org
  2012-06-13 22:10 ` jan.kratochvil at redhat dot com
                   ` (8 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: aoliva at gcc dot gnu.org @ 2012-06-13 21:58 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #3 from Alexandre Oliva <aoliva at gcc dot gnu.org> 2012-06-13 21:57:39 UTC ---
Fixed in mainline.  Is there interest in a backport?


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

* [Bug debug/49888] VTA: -O2 -g variable value changes, it does not change in the source
  2011-07-28 18:04 [Bug debug/49888] New: VTA: -O2 -g variable value changes, it does not change in the source jan.kratochvil at redhat dot com
                   ` (2 preceding siblings ...)
  2012-06-13 21:58 ` aoliva at gcc dot gnu.org
@ 2012-06-13 22:10 ` jan.kratochvil at redhat dot com
  2012-06-22  1:31 ` aoliva at gcc dot gnu.org
                   ` (7 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: jan.kratochvil at redhat dot com @ 2012-06-13 22:10 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #4 from Jan Kratochvil <jan.kratochvil at redhat dot com> 2012-06-13 22:09:40 UTC ---
Great, thanks!
Backport definitely not needed by me.


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

* [Bug debug/49888] VTA: -O2 -g variable value changes, it does not change in the source
  2011-07-28 18:04 [Bug debug/49888] New: VTA: -O2 -g variable value changes, it does not change in the source jan.kratochvil at redhat dot com
                   ` (3 preceding siblings ...)
  2012-06-13 22:10 ` jan.kratochvil at redhat dot com
@ 2012-06-22  1:31 ` aoliva at gcc dot gnu.org
  2012-06-22  1:34 ` aoliva at gcc dot gnu.org
                   ` (6 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: aoliva at gcc dot gnu.org @ 2012-06-22  1:31 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #5 from Alexandre Oliva <aoliva at gcc dot gnu.org> 2012-06-22 01:30:23 UTC ---
Author: aoliva
Date: Fri Jun 22 01:30:16 2012
New Revision: 188868

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=188868
Log:
PR debug/53671
PR debug/49888
* alias.c (memrefs_conflict_p): Improve handling of AND for
alignment.

Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/alias.c


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

* [Bug debug/49888] VTA: -O2 -g variable value changes, it does not change in the source
  2011-07-28 18:04 [Bug debug/49888] New: VTA: -O2 -g variable value changes, it does not change in the source jan.kratochvil at redhat dot com
                   ` (4 preceding siblings ...)
  2012-06-22  1:31 ` aoliva at gcc dot gnu.org
@ 2012-06-22  1:34 ` aoliva at gcc dot gnu.org
  2012-06-28  7:41 ` aoliva at gcc dot gnu.org
                   ` (5 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: aoliva at gcc dot gnu.org @ 2012-06-22  1:34 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #6 from Alexandre Oliva <aoliva at gcc dot gnu.org> 2012-06-22 01:33:27 UTC ---
Author: aoliva
Date: Fri Jun 22 01:33:21 2012
New Revision: 188869

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=188869
Log:
PR debug/53671
PR debug/49888
* var-tracking.c (vt_init_cfa_base): Drop redundant recording of
CFA base.

Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/var-tracking.c

--- Comment #7 from Alexandre Oliva <aoliva at gcc dot gnu.org> 2012-06-22 01:33:50 UTC ---
Author: aoliva
Date: Fri Jun 22 01:33:46 2012
New Revision: 188870

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=188870
Log:
PR debug/53671
PR debug/49888
* var-tracking.c (vt_initialize): Record initial offset between
arg pointer and stack pointer.

Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/var-tracking.c

--- Comment #8 from Alexandre Oliva <aoliva at gcc dot gnu.org> 2012-06-22 01:34:13 UTC ---
Author: aoliva
Date: Fri Jun 22 01:34:05 2012
New Revision: 188871

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=188871
Log:
PR debug/53671
PR debug/49888
* var-tracking.c (vt_get_canonicalize_base): New.
(vt_canonicalize_addr, vt_stack_offset_p): New.
(vt_canon_true_dep): New.
(drop_overlapping_mem_locs): Use vt_canon_true_dep.
(clobber_overlaping_mems): Use vt_canonicalize_addr.

Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/var-tracking.c


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

* [Bug debug/49888] VTA: -O2 -g variable value changes, it does not change in the source
  2011-07-28 18:04 [Bug debug/49888] New: VTA: -O2 -g variable value changes, it does not change in the source jan.kratochvil at redhat dot com
                   ` (5 preceding siblings ...)
  2012-06-22  1:34 ` aoliva at gcc dot gnu.org
@ 2012-06-28  7:41 ` aoliva at gcc dot gnu.org
  2012-07-06 11:37 ` aoliva at gcc dot gnu.org
                   ` (4 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: aoliva at gcc dot gnu.org @ 2012-06-28  7:41 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #9 from Alexandre Oliva <aoliva at gcc dot gnu.org> 2012-06-28 07:41:15 UTC ---
Author: aoliva
Date: Thu Jun 28 07:41:02 2012
New Revision: 189038

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=189038
Log:
PR debug/53671
PR debug/49888
* gcc.dg/guality/pr49888.c: Account for the possibility that
the variable is optimized out at the first test.

Modified:
    trunk/gcc/testsuite/ChangeLog
    trunk/gcc/testsuite/gcc.dg/guality/pr49888.c


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

* [Bug debug/49888] VTA: -O2 -g variable value changes, it does not change in the source
  2011-07-28 18:04 [Bug debug/49888] New: VTA: -O2 -g variable value changes, it does not change in the source jan.kratochvil at redhat dot com
                   ` (6 preceding siblings ...)
  2012-06-28  7:41 ` aoliva at gcc dot gnu.org
@ 2012-07-06 11:37 ` aoliva at gcc dot gnu.org
  2012-11-08  2:57 ` aoliva at gcc dot gnu.org
                   ` (3 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: aoliva at gcc dot gnu.org @ 2012-07-06 11:37 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #10 from Alexandre Oliva <aoliva at gcc dot gnu.org> 2012-07-06 11:37:19 UTC ---
Author: aoliva
Date: Fri Jul  6 11:37:14 2012
New Revision: 189325

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=189325
Log:
PR rtl-optimization/53827
PR debug/53671
PR debug/49888
* alias.c (memrefs_conflict_p): Adjust offset and size by the
same amount for alignment ANDs.

Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/alias.c


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

* [Bug debug/49888] VTA: -O2 -g variable value changes, it does not change in the source
  2011-07-28 18:04 [Bug debug/49888] New: VTA: -O2 -g variable value changes, it does not change in the source jan.kratochvil at redhat dot com
                   ` (7 preceding siblings ...)
  2012-07-06 11:37 ` aoliva at gcc dot gnu.org
@ 2012-11-08  2:57 ` aoliva at gcc dot gnu.org
  2013-01-16  4:32 ` aoliva at gcc dot gnu.org
                   ` (2 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: aoliva at gcc dot gnu.org @ 2012-11-08  2:57 UTC (permalink / raw)
  To: gcc-bugs


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

Alexandre Oliva <aoliva at gcc dot gnu.org> changed:

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

--- Comment #10 from Alexandre Oliva <aoliva at gcc dot gnu.org> 2012-07-06 11:37:19 UTC ---
Author: aoliva
Date: Fri Jul  6 11:37:14 2012
New Revision: 189325

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=189325
Log:
PR rtl-optimization/53827
PR debug/53671
PR debug/49888
* alias.c (memrefs_conflict_p): Adjust offset and size by the
same amount for alignment ANDs.

Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/alias.c

--- Comment #11 from Alexandre Oliva <aoliva at gcc dot gnu.org> 2012-11-08 02:57:12 UTC ---
Fixed.  Not backporting.


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

* [Bug debug/49888] VTA: -O2 -g variable value changes, it does not change in the source
  2011-07-28 18:04 [Bug debug/49888] New: VTA: -O2 -g variable value changes, it does not change in the source jan.kratochvil at redhat dot com
                   ` (8 preceding siblings ...)
  2012-11-08  2:57 ` aoliva at gcc dot gnu.org
@ 2013-01-16  4:32 ` aoliva at gcc dot gnu.org
  2013-01-18 10:59 ` aoliva at gcc dot gnu.org
  2013-01-18 11:01 ` aoliva at gcc dot gnu.org
  11 siblings, 0 replies; 13+ messages in thread
From: aoliva at gcc dot gnu.org @ 2013-01-16  4:32 UTC (permalink / raw)
  To: gcc-bugs


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

--- Comment #12 from Alexandre Oliva <aoliva at gcc dot gnu.org> 2013-01-16 04:31:42 UTC ---
Author: aoliva
Date: Wed Jan 16 04:31:30 2013
New Revision: 195227

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=195227
Log:
PR rtl-optimization/55547
PR rtl-optimization/53827
PR debug/53671
PR debug/49888
* alias.c (memrefs_conflict_p): Set sizes to negative after
AND adjustments.

Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/alias.c


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

* [Bug debug/49888] VTA: -O2 -g variable value changes, it does not change in the source
  2011-07-28 18:04 [Bug debug/49888] New: VTA: -O2 -g variable value changes, it does not change in the source jan.kratochvil at redhat dot com
                   ` (9 preceding siblings ...)
  2013-01-16  4:32 ` aoliva at gcc dot gnu.org
@ 2013-01-18 10:59 ` aoliva at gcc dot gnu.org
  2013-01-18 11:01 ` aoliva at gcc dot gnu.org
  11 siblings, 0 replies; 13+ messages in thread
From: aoliva at gcc dot gnu.org @ 2013-01-18 10:59 UTC (permalink / raw)
  To: gcc-bugs


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

--- Comment #13 from Alexandre Oliva <aoliva at gcc dot gnu.org> 2013-01-18 10:57:51 UTC ---
Author: aoliva
Date: Fri Jan 18 10:57:36 2013
New Revision: 195289

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=195289
Log:
PR rtl-optimization/55547
PR rtl-optimization/53827
PR debug/53671
PR debug/49888
* alias.c (offset_overlap_p): New, factored out of...
(memrefs_conflict_p): ... this.  Use absolute sizes.  Retain
the conservative special case for symbolic constants.  Don't
adjust zero sizes on alignment.

Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/alias.c


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

* [Bug debug/49888] VTA: -O2 -g variable value changes, it does not change in the source
  2011-07-28 18:04 [Bug debug/49888] New: VTA: -O2 -g variable value changes, it does not change in the source jan.kratochvil at redhat dot com
                   ` (10 preceding siblings ...)
  2013-01-18 10:59 ` aoliva at gcc dot gnu.org
@ 2013-01-18 11:01 ` aoliva at gcc dot gnu.org
  11 siblings, 0 replies; 13+ messages in thread
From: aoliva at gcc dot gnu.org @ 2013-01-18 11:01 UTC (permalink / raw)
  To: gcc-bugs


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

--- Comment #14 from Alexandre Oliva <aoliva at gcc dot gnu.org> 2013-01-18 10:58:45 UTC ---
Author: aoliva
Date: Fri Jan 18 10:58:15 2013
New Revision: 195291

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=195291
Log:
PR debug/54114
PR debug/54402
PR debug/49888
* var-tracking.c (negative_power_of_two_p): New.
(global_get_addr_cache, local_get_addr_cache): New.
(get_addr_from_global_cache, get_addr_from_local_cache): New.
(vt_canonicalize_addr): Rewrite using the above.  Adjust the
heading comment.
(vt_stack_offset_p): Remove.
(vt_canon_true_dep): Always canonicalize loc's address.
(clobber_overlapping_mems): Make sure we have a MEM.
(local_get_addr_clear_given_value): New.
(val_reset): Clear local cached entries.
(compute_bb_dataflow): Create and release the local cache.
Disable duplicate MEMs clobbering.
(emit_notes_in_bb): Clobber MEMs likewise.
(vt_emit_notes): Create and release the local cache.
(vt_initialize, vt_finalize): Create and release the global
cache, respectively.
* alias.c (rtx_equal_for_memref_p): Compare operands of
ENTRY_VALUEs.

Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/alias.c
    trunk/gcc/var-tracking.c


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

end of thread, other threads:[~2013-01-18 11:00 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-07-28 18:04 [Bug debug/49888] New: VTA: -O2 -g variable value changes, it does not change in the source jan.kratochvil at redhat dot com
2012-05-23  9:36 ` [Bug debug/49888] " aoliva at gcc dot gnu.org
2012-06-13 21:44 ` aoliva at gcc dot gnu.org
2012-06-13 21:58 ` aoliva at gcc dot gnu.org
2012-06-13 22:10 ` jan.kratochvil at redhat dot com
2012-06-22  1:31 ` aoliva at gcc dot gnu.org
2012-06-22  1:34 ` aoliva at gcc dot gnu.org
2012-06-28  7:41 ` aoliva at gcc dot gnu.org
2012-07-06 11:37 ` aoliva at gcc dot gnu.org
2012-11-08  2:57 ` aoliva at gcc dot gnu.org
2013-01-16  4:32 ` aoliva at gcc dot gnu.org
2013-01-18 10:59 ` aoliva at gcc dot gnu.org
2013-01-18 11:01 ` aoliva 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).