public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug ada/45003]  New: VTA issues with sign/zero extension and debug temporaries
@ 2010-07-20 10:31 jakub at gcc dot gnu dot org
  2010-07-20 10:40 ` [Bug ada/45003] " jakub at gcc dot gnu dot org
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: jakub at gcc dot gnu dot org @ 2010-07-20 10:31 UTC (permalink / raw)
  To: gcc-bugs

The following testcase shows two issues with VTA.  I have a patch for one of
the issues, the second one needs some thought.


-- 
           Summary: VTA issues with sign/zero extension and debug
                    temporaries
           Product: gcc
           Version: 4.6.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: ada
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: jakub at gcc dot gnu dot org


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


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

* [Bug ada/45003] VTA issues with sign/zero extension and debug temporaries
  2010-07-20 10:31 [Bug ada/45003] New: VTA issues with sign/zero extension and debug temporaries jakub at gcc dot gnu dot org
@ 2010-07-20 10:40 ` jakub at gcc dot gnu dot org
  2010-07-20 10:42 ` jakub at gcc dot gnu dot org
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: jakub at gcc dot gnu dot org @ 2010-07-20 10:40 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from jakub at gcc dot gnu dot org  2010-07-20 10:40 -------
/* PR debug/45003 */
/* { dg-do run { target { x86_64-*-* && lp64 } } } */
/* { dg-options "-g" } */

int __attribute__((noinline))
foo (unsigned short *p)
{
  int a = *p;
  asm volatile ("nop" : : "D" ((int) *p));
  asm volatile ("nop" : : "D" ((int) *p));/* { dg-final { gdb-test 10 "a"
"0x8078" } } */
  return 0;
}

int __attribute__((noinline))
bar (short *p)
{
  unsigned int a = *p;
  asm volatile ("nop" : : "D" ((unsigned int) *p));
  asm volatile ("nop" : : "D" ((unsigned int) *p));/* { dg-final { gdb-test 19
"a" "-32648" } } */
  return 0;
}

int
main ()
{
  unsigned short us = 0x8078;
  foo (&us);
  short s = -32648;
  bar (&s);
  return 0;
}

There are two problems.  One is that in DEBUG_INSN we use wrong extension (in
foo SIGN_EXTEND instead of ZERO_EXTEND, in bar the other way around).  The
second issue is that debug temporaries prevent us to see that the value
actually is still live in the %edi register, because one VALUE is used for
(zero_extend:SI (debug_expr:HI D#1)) and another one for (zero_extend:SI
(mem:HI (...)) where the debug temporary is the MEM.

For the second issue, one possibility would be to find debug temporaries that
are set just once and use their associated VALUE directly instead of the
DEBUG_EXPR.  The other possibility would be if we see that SIGN_EXTEND or
ZERO_EXTEND of something is loaded into a register, note not just that the
SIGN_EXTEND/ZERO_EXTEND VALUE lives in that register, but also that the
operand's VALUE lives in the low part of that register.  Alex, what do you
think?


-- 


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


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

* [Bug ada/45003] VTA issues with sign/zero extension and debug temporaries
  2010-07-20 10:31 [Bug ada/45003] New: VTA issues with sign/zero extension and debug temporaries jakub at gcc dot gnu dot org
  2010-07-20 10:40 ` [Bug ada/45003] " jakub at gcc dot gnu dot org
@ 2010-07-20 10:42 ` jakub at gcc dot gnu dot org
  2010-07-20 12:58 ` jakub at gcc dot gnu dot org
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: jakub at gcc dot gnu dot org @ 2010-07-20 10:42 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #2 from jakub at gcc dot gnu dot org  2010-07-20 10:42 -------
Created an attachment (id=21259)
 --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=21259&action=view)
gcc46-pr45003.patch

Here is a fix for the first issue.


-- 


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


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

* [Bug ada/45003] VTA issues with sign/zero extension and debug temporaries
  2010-07-20 10:31 [Bug ada/45003] New: VTA issues with sign/zero extension and debug temporaries jakub at gcc dot gnu dot org
  2010-07-20 10:40 ` [Bug ada/45003] " jakub at gcc dot gnu dot org
  2010-07-20 10:42 ` jakub at gcc dot gnu dot org
@ 2010-07-20 12:58 ` jakub at gcc dot gnu dot org
  2010-07-20 16:27 ` [Bug debug/45003] " jakub at gcc dot gnu dot org
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: jakub at gcc dot gnu dot org @ 2010-07-20 12:58 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #3 from jakub at gcc dot gnu dot org  2010-07-20 12:58 -------
Subject: Bug 45003

Author: jakub
Date: Tue Jul 20 12:58:03 2010
New Revision: 162336

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=162336
Log:
        PR debug/45003
        * cfgexpand.c (expand_debug_expr) <case NOP_EXPR>: Use ZERO_EXTEND
        or SIGN_EXTEND depending on TYPE_UNSIGNED of the operand's type
        instead of the result's type.

        * gcc.dg/guality/pr45003-1.c: New test.

Added:
    trunk/gcc/testsuite/gcc.dg/guality/pr45003-1.c
Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/cfgexpand.c
    trunk/gcc/testsuite/ChangeLog


-- 


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


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

* [Bug debug/45003] VTA issues with sign/zero extension and debug temporaries
  2010-07-20 10:31 [Bug ada/45003] New: VTA issues with sign/zero extension and debug temporaries jakub at gcc dot gnu dot org
                   ` (2 preceding siblings ...)
  2010-07-20 12:58 ` jakub at gcc dot gnu dot org
@ 2010-07-20 16:27 ` jakub at gcc dot gnu dot org
  2010-07-21  8:51 ` jakub at gcc dot gnu dot org
  2010-07-21  8:59 ` jakub at gcc dot gnu dot org
  5 siblings, 0 replies; 7+ messages in thread
From: jakub at gcc dot gnu dot org @ 2010-07-20 16:27 UTC (permalink / raw)
  To: gcc-bugs



-- 

jakub at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         AssignedTo|unassigned at gcc dot gnu   |jakub at gcc dot gnu dot org
                   |dot org                     |
             Status|UNCONFIRMED                 |ASSIGNED
          Component|ada                         |debug
     Ever Confirmed|0                           |1
   Last reconfirmed|0000-00-00 00:00:00         |2010-07-20 16:26:45
               date|                            |


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


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

* [Bug debug/45003] VTA issues with sign/zero extension and debug temporaries
  2010-07-20 10:31 [Bug ada/45003] New: VTA issues with sign/zero extension and debug temporaries jakub at gcc dot gnu dot org
                   ` (3 preceding siblings ...)
  2010-07-20 16:27 ` [Bug debug/45003] " jakub at gcc dot gnu dot org
@ 2010-07-21  8:51 ` jakub at gcc dot gnu dot org
  2010-07-21  8:59 ` jakub at gcc dot gnu dot org
  5 siblings, 0 replies; 7+ messages in thread
From: jakub at gcc dot gnu dot org @ 2010-07-21  8:51 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #4 from jakub at gcc dot gnu dot org  2010-07-21 08:51 -------
Subject: Bug 45003

Author: jakub
Date: Wed Jul 21 08:50:57 2010
New Revision: 162364

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=162364
Log:
        PR debug/45003
        * var-tracking.c (reverse_op): Also handle {SIGN,ZERO}_EXTEND of
        a MEM.
        * dwarf2out.c (loc_descriptor): Don't handle SIGN_EXTEND nor
        ZERO_EXTEND here.

        * gcc.dg/guality/pr45003-2.c: New test.
        * gcc.dg/guality/pr45003-3.c: New test.

Added:
    trunk/gcc/testsuite/gcc.dg/guality/pr45003-2.c
    trunk/gcc/testsuite/gcc.dg/guality/pr45003-3.c
Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/dwarf2out.c
    trunk/gcc/testsuite/ChangeLog
    trunk/gcc/var-tracking.c


-- 


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


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

* [Bug debug/45003] VTA issues with sign/zero extension and debug temporaries
  2010-07-20 10:31 [Bug ada/45003] New: VTA issues with sign/zero extension and debug temporaries jakub at gcc dot gnu dot org
                   ` (4 preceding siblings ...)
  2010-07-21  8:51 ` jakub at gcc dot gnu dot org
@ 2010-07-21  8:59 ` jakub at gcc dot gnu dot org
  5 siblings, 0 replies; 7+ messages in thread
From: jakub at gcc dot gnu dot org @ 2010-07-21  8:59 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #5 from jakub at gcc dot gnu dot org  2010-07-21 08:59 -------
Fixed.


-- 

jakub at gcc dot gnu dot org changed:

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


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


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

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

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-07-20 10:31 [Bug ada/45003] New: VTA issues with sign/zero extension and debug temporaries jakub at gcc dot gnu dot org
2010-07-20 10:40 ` [Bug ada/45003] " jakub at gcc dot gnu dot org
2010-07-20 10:42 ` jakub at gcc dot gnu dot org
2010-07-20 12:58 ` jakub at gcc dot gnu dot org
2010-07-20 16:27 ` [Bug debug/45003] " jakub at gcc dot gnu dot org
2010-07-21  8:51 ` jakub at gcc dot gnu dot org
2010-07-21  8:59 ` jakub at gcc dot gnu dot 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).