public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/51196] New: FAIL: g++.dg/cpp0x/Wzero-as-null-pointer-constant-1.C
@ 2011-11-17 17:06 Greta.Yorsh at arm dot com
  2011-11-17 17:41 ` [Bug c++/51196] " paolo.carlini at oracle dot com
                   ` (7 more replies)
  0 siblings, 8 replies; 9+ messages in thread
From: Greta.Yorsh at arm dot com @ 2011-11-17 17:06 UTC (permalink / raw)
  To: gcc-bugs

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

             Bug #: 51196
           Summary: FAIL: g++.dg/cpp0x/Wzero-as-null-pointer-constant-1.C
    Classification: Unclassified
           Product: gcc
           Version: 4.7.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: Greta.Yorsh@arm.com
                CC: jason@redhat.com, paolo.carlini@oracle.com
            Target: arm-none-eabi


The warnings for variable pmf are not produced as expected in this test. The
test was introduced by a patch for PR44277.

FAIL: g++.dg/cpp0x/Wzero-as-null-pointer-constant-1.C  (test for warnings, line
66)
FAIL: g++.dg/cpp0x/Wzero-as-null-pointer-constant-1.C  (test for warnings, line
78)
FAIL: g++.dg/cpp0x/Wzero-as-null-pointer-constant-1.C  (test for warnings, line
90)
FAIL: g++.dg/cpp0x/Wzero-as-null-pointer-constant-1.C  (test for warnings, line
102)
FAIL: g++.dg/warn/Wzero-as-null-pointer-constant-1.C -std=gnu++98  (test for
warnings, line 53)
FAIL: g++.dg/warn/Wzero-as-null-pointer-constant-1.C -std=gnu++98  (test for
warnings, line 65)
FAIL: g++.dg/warn/Wzero-as-null-pointer-constant-1.C -std=gnu++98  (test for
warnings, line 77)
FAIL: g++.dg/warn/Wzero-as-null-pointer-constant-1.C -std=gnu++98  (test for
warnings, line 89)
FAIL: g++.dg/warn/Wzero-as-null-pointer-constant-1.C -std=gnu++11  (test for
warnings, line 53)
FAIL: g++.dg/warn/Wzero-as-null-pointer-constant-1.C -std=gnu++11  (test for
warnings, line 65)
FAIL: g++.dg/warn/Wzero-as-null-pointer-constant-1.C -std=gnu++11  (test for
warnings, line 77)
FAIL: g++.dg/warn/Wzero-as-null-pointer-constant-1.C -std=gnu++11  (test for
warnings, line 89)


Target: arm-none-eabi

Configured with: --with-cpu=cortex-a9 --with-float=softfp --with-fpu=neon
--enable-checking=release --disable-gdbtk --disable-werror --disable-tui
--disable-rda --disable-sid --disable-utils --disable-lto --disable-lto
--disable-werror --disable-shared --disable-nls --disable-threads --disable-tls
--enable-checking=yes --enable-languages=c,c++,fortran --with-newlib
Thread model: single
gcc version 4.7.0 20111107 (experimental) (GCC)


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

* [Bug c++/51196] FAIL: g++.dg/cpp0x/Wzero-as-null-pointer-constant-1.C
  2011-11-17 17:06 [Bug c++/51196] New: FAIL: g++.dg/cpp0x/Wzero-as-null-pointer-constant-1.C Greta.Yorsh at arm dot com
@ 2011-11-17 17:41 ` paolo.carlini at oracle dot com
  2011-11-17 17:52 ` jason at gcc dot gnu.org
                   ` (6 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: paolo.carlini at oracle dot com @ 2011-11-17 17:41 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #1 from Paolo Carlini <paolo.carlini at oracle dot com> 2011-11-17 17:33:43 UTC ---
That's a pity, but personally frankly I don't think I will be able to seriously
debug for this target in the near future. Or maybe Jason has something to
suggest. Otherwise I propose to xfail on arm, for 4.7.


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

* [Bug c++/51196] FAIL: g++.dg/cpp0x/Wzero-as-null-pointer-constant-1.C
  2011-11-17 17:06 [Bug c++/51196] New: FAIL: g++.dg/cpp0x/Wzero-as-null-pointer-constant-1.C Greta.Yorsh at arm dot com
  2011-11-17 17:41 ` [Bug c++/51196] " paolo.carlini at oracle dot com
@ 2011-11-17 17:52 ` jason at gcc dot gnu.org
  2011-11-17 18:38 ` paolo.carlini at oracle dot com
                   ` (5 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: jason at gcc dot gnu.org @ 2011-11-17 17:52 UTC (permalink / raw)
  To: gcc-bugs

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

Jason Merrill <jason at gcc dot gnu.org> changed:

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

--- Comment #2 from Jason Merrill <jason at gcc dot gnu.org> 2011-11-17 17:44:54 UTC ---
(In reply to comment #1)
> I don't think I will be able to seriously
> debug for this target in the near future.

It's easy to build a cross-compiler for compile-time tests like this.  Just

.../configure --target arm-none-eabi --enable-languages=c++ && make all-gcc

should get as far as building cc1plus, which is all you need to debug most PRs.


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

* [Bug c++/51196] FAIL: g++.dg/cpp0x/Wzero-as-null-pointer-constant-1.C
  2011-11-17 17:06 [Bug c++/51196] New: FAIL: g++.dg/cpp0x/Wzero-as-null-pointer-constant-1.C Greta.Yorsh at arm dot com
  2011-11-17 17:41 ` [Bug c++/51196] " paolo.carlini at oracle dot com
  2011-11-17 17:52 ` jason at gcc dot gnu.org
@ 2011-11-17 18:38 ` paolo.carlini at oracle dot com
  2011-11-21 16:25 ` paolo.carlini at oracle dot com
                   ` (4 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: paolo.carlini at oracle dot com @ 2011-11-17 18:38 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #3 from Paolo Carlini <paolo.carlini at oracle dot com> 2011-11-17 18:14:16 UTC ---
I'll see what I can do... At the moment really I have no idea why for this
target only we have a different behavior.


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

* [Bug c++/51196] FAIL: g++.dg/cpp0x/Wzero-as-null-pointer-constant-1.C
  2011-11-17 17:06 [Bug c++/51196] New: FAIL: g++.dg/cpp0x/Wzero-as-null-pointer-constant-1.C Greta.Yorsh at arm dot com
                   ` (2 preceding siblings ...)
  2011-11-17 18:38 ` paolo.carlini at oracle dot com
@ 2011-11-21 16:25 ` paolo.carlini at oracle dot com
  2011-11-21 17:31 ` paolo.carlini at oracle dot com
                   ` (3 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: paolo.carlini at oracle dot com @ 2011-11-21 16:25 UTC (permalink / raw)
  To: gcc-bugs

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

Paolo Carlini <paolo.carlini at oracle dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|Greta.Yorsh at arm dot com  |

--- Comment #4 from Paolo Carlini <paolo.carlini at oracle dot com> 2011-11-21 15:53:55 UTC ---
Unexpectedly ;) I'm making progress debugging this: what happens is that, for
arm, in cp_build_binary_op, case EQ_EXPR (this is for 'if (pmf == 0)') here:

      if (TARGET_PTRMEMFUNC_VBIT_LOCATION
          == ptrmemfunc_vbit_in_delta)
        {
          tree pfn0 = pfn_from_ptrmemfunc (op0);
          tree delta0 = delta_from_ptrmemfunc (op0);
          tree e1 = cp_build_binary_op (location,
                        EQ_EXPR,
                              pfn0,    
                              build_zero_cst (TREE_TYPE (pfn0)),
                        complain);
          tree e2 = cp_build_binary_op (location,
                        BIT_AND_EXPR, 
                        delta0,
                            integer_one_node,
                        complain);
          e2 = cp_build_binary_op (location,
                       EQ_EXPR, e2, integer_zero_node,
                       complain);
          op0 = cp_build_binary_op (location,
                    TRUTH_ANDIF_EXPR, e1, e2,
                    complain);
          op1 = cp_convert (TREE_TYPE (op0), integer_one_node); 
        }
           else 
        {
          op0 = build_ptrmemfunc_access_expr (op0, pfn_identifier);
          op1 = cp_convert (TREE_TYPE (op0), op1);
        }

the condition is true, thus we don't call cp_convert with op1, which is
integer_zero_node here, instead we pass integer_one_node to cp_convert and the
warning down in cp_convert_to_pointer cannot possibly trigger (actually, for
arm we don't even reach cp_convert_to_pointer)

Thus, an idea for fixing the problem would be just warn right here for arm and
similar targets, because here we know that op1 is indeed integer_zero_node (and
that TYPE_PTRMEMFUNC_P (type0) is true of course)

Jason, can you imagine something neater?


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

* [Bug c++/51196] FAIL: g++.dg/cpp0x/Wzero-as-null-pointer-constant-1.C
  2011-11-17 17:06 [Bug c++/51196] New: FAIL: g++.dg/cpp0x/Wzero-as-null-pointer-constant-1.C Greta.Yorsh at arm dot com
                   ` (3 preceding siblings ...)
  2011-11-21 16:25 ` paolo.carlini at oracle dot com
@ 2011-11-21 17:31 ` paolo.carlini at oracle dot com
  2011-11-22 11:33 ` Greta.Yorsh at arm dot com
                   ` (2 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: paolo.carlini at oracle dot com @ 2011-11-21 17:31 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #5 from Paolo Carlini <paolo.carlini at oracle dot com> 2011-11-21 17:04:47 UTC ---
Created attachment 25873
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=25873
Sanity checked on x86_64-linux and lightly tested arm-none-eabi

In practice, this works for me. Maybe Greta can test it more carefully.


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

* [Bug c++/51196] FAIL: g++.dg/cpp0x/Wzero-as-null-pointer-constant-1.C
  2011-11-17 17:06 [Bug c++/51196] New: FAIL: g++.dg/cpp0x/Wzero-as-null-pointer-constant-1.C Greta.Yorsh at arm dot com
                   ` (4 preceding siblings ...)
  2011-11-21 17:31 ` paolo.carlini at oracle dot com
@ 2011-11-22 11:33 ` Greta.Yorsh at arm dot com
  2011-11-22 15:21 ` paolo at gcc dot gnu.org
  2011-11-22 15:25 ` paolo.carlini at oracle dot com
  7 siblings, 0 replies; 9+ messages in thread
From: Greta.Yorsh at arm dot com @ 2011-11-22 11:33 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #6 from Greta Yorsh <Greta.Yorsh at arm dot com> 2011-11-22 10:56:41 UTC ---
Thanks for fixing it, Paolo. Tested as follows.

Successful cross-build of the patch version for arm-none-eabi target,
configured as before. No regression on qemu for check-g++. The tests for
g++.dg/cpp0x/Wzero-as-null-pointer-constant-1.C all pass. 

Can you see the patch committed to trunk, please? 

Thank you,
Greta


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

* [Bug c++/51196] FAIL: g++.dg/cpp0x/Wzero-as-null-pointer-constant-1.C
  2011-11-17 17:06 [Bug c++/51196] New: FAIL: g++.dg/cpp0x/Wzero-as-null-pointer-constant-1.C Greta.Yorsh at arm dot com
                   ` (5 preceding siblings ...)
  2011-11-22 11:33 ` Greta.Yorsh at arm dot com
@ 2011-11-22 15:21 ` paolo at gcc dot gnu.org
  2011-11-22 15:25 ` paolo.carlini at oracle dot com
  7 siblings, 0 replies; 9+ messages in thread
From: paolo at gcc dot gnu.org @ 2011-11-22 15:21 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #7 from paolo at gcc dot gnu.org <paolo at gcc dot gnu.org> 2011-11-22 15:04:33 UTC ---
Author: paolo
Date: Tue Nov 22 15:04:27 2011
New Revision: 181620

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=181620
Log:
2011-11-22  Paolo Carlini  <paolo.carlini@oracle.com>

    PR c++/51196
    * typeck.c (cp_build_binary_op, [case EQ_EXPR]): For targets having
    TARGET_PTRMEMFUNC_VBIT_LOCATION == ptrmemfunc_vbit_in_delta, do here
    the -Wzero-as-null-pointer-constant warning for pmf == 0.

Modified:
    trunk/gcc/cp/ChangeLog
    trunk/gcc/cp/typeck.c


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

* [Bug c++/51196] FAIL: g++.dg/cpp0x/Wzero-as-null-pointer-constant-1.C
  2011-11-17 17:06 [Bug c++/51196] New: FAIL: g++.dg/cpp0x/Wzero-as-null-pointer-constant-1.C Greta.Yorsh at arm dot com
                   ` (6 preceding siblings ...)
  2011-11-22 15:21 ` paolo at gcc dot gnu.org
@ 2011-11-22 15:25 ` paolo.carlini at oracle dot com
  7 siblings, 0 replies; 9+ messages in thread
From: paolo.carlini at oracle dot com @ 2011-11-22 15:25 UTC (permalink / raw)
  To: gcc-bugs

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

Paolo Carlini <paolo.carlini at oracle dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|                            |FIXED
   Target Milestone|---                         |4.7.0

--- Comment #8 from Paolo Carlini <paolo.carlini at oracle dot com> 2011-11-22 15:06:34 UTC ---
Thanks a lot Greta for testing, patch applied!


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

end of thread, other threads:[~2011-11-22 15:06 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-11-17 17:06 [Bug c++/51196] New: FAIL: g++.dg/cpp0x/Wzero-as-null-pointer-constant-1.C Greta.Yorsh at arm dot com
2011-11-17 17:41 ` [Bug c++/51196] " paolo.carlini at oracle dot com
2011-11-17 17:52 ` jason at gcc dot gnu.org
2011-11-17 18:38 ` paolo.carlini at oracle dot com
2011-11-21 16:25 ` paolo.carlini at oracle dot com
2011-11-21 17:31 ` paolo.carlini at oracle dot com
2011-11-22 11:33 ` Greta.Yorsh at arm dot com
2011-11-22 15:21 ` paolo at gcc dot gnu.org
2011-11-22 15:25 ` paolo.carlini at oracle dot com

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).