public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/62294] New: Missing "passing argument [...] from incompatible pointer type" warning.
@ 2014-08-28 15:20 Emmanuel.Thome at inria dot fr
  2014-09-01 15:33 ` [Bug c/62294] [4.9 Regression] " mpolacek at gcc dot gnu.org
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: Emmanuel.Thome at inria dot fr @ 2014-08-28 15:20 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 62294
           Summary: Missing "passing argument [...] from incompatible
                    pointer type" warning.
           Product: gcc
           Version: 4.9.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
          Assignee: unassigned at gcc dot gnu.org
          Reporter: Emmanuel.Thome at inria dot fr

Hi.

The following code should cause a warning.

#include <gmp.h>

void what(mpz_t a, mpz_t p, gmp_randstate_t rstate)
{
    mpz_urandomm(a, p, rstate); /* WRONG */
    mpz_urandomm(a, rstate, p); /* correct */
}

Alas, gcc-4.9.1 seems happy:
/tmp $ gcc-4.9 -W -Wall -Wextra -c b.c

gcc-4.8 moans appropriately.
/tmp $ gcc-4.8 -W -Wall -Wextra -c b.c
b.c: In function ‘what’:
b.c:5:5: warning: passing argument 2 of ‘__gmpz_urandomm’ from incompatible
pointer type [enabled by default]
     mpz_urandomm(a, p, rstate); /* WRONG */
     ^
In file included from b.c:1:0:
/usr/include/x86_64-linux-gnu/gmp.h:1115:21: note: expected ‘struct
__gmp_randstate_struct *’ but argument is of type ‘struct __mpz_struct *’
 __GMP_DECLSPEC void mpz_urandomm (mpz_ptr, gmp_randstate_t, mpz_srcptr);
                     ^
b.c:5:5: warning: passing argument 3 of ‘__gmpz_urandomm’ from incompatible
pointer type [enabled by default]
     mpz_urandomm(a, p, rstate); /* WRONG */
     ^
In file included from b.c:1:0:
/usr/include/x86_64-linux-gnu/gmp.h:1115:21: note: expected ‘mpz_srcptr’ but
argument is of type ‘struct __gmp_randstate_struct *’
 __GMP_DECLSPEC void mpz_urandomm (mpz_ptr, gmp_randstate_t, mpz_srcptr);

Here is gcc -v:

/tmp $ gcc-4.9 -v
Using built-in specs.
COLLECT_GCC=gcc-4.9
COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-linux-gnu/4.9/lto-wrapper
Target: x86_64-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Debian 4.9.1-4'
--with-bugurl=file:///usr/share/doc/gcc-4.9/README.Bugs
--enable-languages=c,c++,java,go,d,fortran,objc,obj-c++ --prefix=/usr
--program-suffix=-4.9 --enable-shared --enable-linker-build-id
--libexecdir=/usr/lib --without-included-gettext --enable-threads=posix
--with-gxx-include-dir=/usr/include/c++/4.9 --libdir=/usr/lib --enable-nls
--with-sysroot=/ --enable-clocale=gnu --enable-libstdcxx-debug
--enable-libstdcxx-time=yes --enable-gnu-unique-object --disable-vtable-verify
--enable-plugin --with-system-zlib --disable-browser-plugin
--enable-java-awt=gtk --enable-gtk-cairo
--with-java-home=/usr/lib/jvm/java-1.5.0-gcj-4.9-amd64/jre --enable-java-home
--with-jvm-root-dir=/usr/lib/jvm/java-1.5.0-gcj-4.9-amd64
--with-jvm-jar-dir=/usr/lib/jvm-exports/java-1.5.0-gcj-4.9-amd64
--with-arch-directory=amd64 --with-ecj-jar=/usr/share/java/eclipse-ecj.jar
--enable-objc-gc --enable-multiarch --with-arch-32=i586 --with-abi=m64
--with-multilib-list=m32,m64,mx32 --enable-multilib --with-tune=generic
--enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu
--target=x86_64-linux-gnu
Thread model: posix
gcc version 4.9.1 (Debian 4.9.1-4) 

I'm happy to provide any further information.

Regards,

E.
>From gcc-bugs-return-459417-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org Thu Aug 28 15:52:01 2014
Return-Path: <gcc-bugs-return-459417-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org>
Delivered-To: listarch-gcc-bugs@gcc.gnu.org
Received: (qmail 24262 invoked by alias); 28 Aug 2014 15:52:01 -0000
Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm
Precedence: bulk
List-Id: <gcc-bugs.gcc.gnu.org>
List-Archive: <http://gcc.gnu.org/ml/gcc-bugs/>
List-Post: <mailto:gcc-bugs@gcc.gnu.org>
List-Help: <mailto:gcc-bugs-help@gcc.gnu.org>
Sender: gcc-bugs-owner@gcc.gnu.org
Delivered-To: mailing list gcc-bugs@gcc.gnu.org
Received: (qmail 24229 invoked by uid 48); 28 Aug 2014 15:51:57 -0000
From: "glisse at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug c/62294] [4.9 Regression] Missing "passing argument [...] from incompatible pointer type" warning.
Date: Thu, 28 Aug 2014 15:52:00 -0000
X-Bugzilla-Reason: CC
X-Bugzilla-Type: changed
X-Bugzilla-Watch-Reason: None
X-Bugzilla-Product: gcc
X-Bugzilla-Component: c
X-Bugzilla-Version: 4.9.1
X-Bugzilla-Keywords: diagnostic
X-Bugzilla-Severity: normal
X-Bugzilla-Who: glisse at gcc dot gnu.org
X-Bugzilla-Status: NEW
X-Bugzilla-Priority: P3
X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org
X-Bugzilla-Target-Milestone: ---
X-Bugzilla-Flags:
X-Bugzilla-Changed-Fields: keywords bug_status cf_reconfirmed_on short_desc everconfirmed
Message-ID: <bug-62294-4-mOuwoFjq3F@http.gcc.gnu.org/bugzilla/>
In-Reply-To: <bug-62294-4@http.gcc.gnu.org/bugzilla/>
References: <bug-62294-4@http.gcc.gnu.org/bugzilla/>
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: 7bit
X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/
Auto-Submitted: auto-generated
MIME-Version: 1.0
X-SW-Source: 2014-08/txt/msg01914.txt.bz2
Content-length: 1007

https://gcc.gnu.org/bugzilla/show_bug.cgi?idb294

Marc Glisse <glisse at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |diagnostic
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2014-08-28
            Summary|Missing "passing argument   |[4.9 Regression] Missing
                   |[...] from incompatible     |"passing argument [...]
                   |pointer type" warning.      |from incompatible pointer
                   |                            |type" warning.
     Ever confirmed|0                           |1

--- Comment #1 from Marc Glisse <glisse at gcc dot gnu.org> ---
Hmm, it works with gcc-5 where it is controlled by -Wincompatible-pointer-types
(enabled by default), but that's a recent thing and 4.9 was still supposed to
have it directly enabled by default...


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

* [Bug c/62294] [4.9 Regression] Missing "passing argument [...] from incompatible pointer type" warning.
  2014-08-28 15:20 [Bug c/62294] New: Missing "passing argument [...] from incompatible pointer type" warning Emmanuel.Thome at inria dot fr
@ 2014-09-01 15:33 ` mpolacek at gcc dot gnu.org
  2014-09-03 12:54 ` mpolacek at gcc dot gnu.org
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2014-09-01 15:33 UTC (permalink / raw)
  To: gcc-bugs

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

Marek Polacek <mpolacek at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |ASSIGNED
                 CC|                            |mpolacek at gcc dot gnu.org
           Assignee|unassigned at gcc dot gnu.org      |mpolacek at gcc dot gnu.org
   Target Milestone|---                         |4.9.2

--- Comment #2 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
I broke it in r207335 (UNKNOWN_LOCATION bit).  It got fixed in r210980, but
that's not in 4.9.  I'll prepare a 4.9 patch.


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

* [Bug c/62294] [4.9 Regression] Missing "passing argument [...] from incompatible pointer type" warning.
  2014-08-28 15:20 [Bug c/62294] New: Missing "passing argument [...] from incompatible pointer type" warning Emmanuel.Thome at inria dot fr
  2014-09-01 15:33 ` [Bug c/62294] [4.9 Regression] " mpolacek at gcc dot gnu.org
@ 2014-09-03 12:54 ` mpolacek at gcc dot gnu.org
  2014-09-03 12:55 ` mpolacek at gcc dot gnu.org
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2014-09-03 12:54 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #3 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
Author: mpolacek
Date: Wed Sep  3 12:54:06 2014
New Revision: 214874

URL: https://gcc.gnu.org/viewcvs?rev=214874&root=gcc&view=rev
Log:
    PR c/62294
    * c-typeck.c (convert_arguments): Get location of a parameter.  Change
    error and warning calls to error_at and warning_at.  Pass location of
    a parameter to it.
    (convert_for_assignment): Add parameter to WARN_FOR_ASSIGNMENT and
    WARN_FOR_QUALIFIERS.  Pass expr_loc to those.

    * gcc.dg/pr56724-1.c: New test.
    * gcc.dg/pr56724-2.c: New test.
    * gcc.dg/pr62294.c: New test.
    * gcc.dg/pr62294.h: New file.

Added:
    branches/gcc-4_9-branch/gcc/testsuite/gcc.dg/pr56724-1.c
    branches/gcc-4_9-branch/gcc/testsuite/gcc.dg/pr56724-2.c
    branches/gcc-4_9-branch/gcc/testsuite/gcc.dg/pr62294.c
    branches/gcc-4_9-branch/gcc/testsuite/gcc.dg/pr62294.h
Modified:
    branches/gcc-4_9-branch/gcc/c/ChangeLog
    branches/gcc-4_9-branch/gcc/c/c-typeck.c
    branches/gcc-4_9-branch/gcc/testsuite/ChangeLog


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

* [Bug c/62294] [4.9 Regression] Missing "passing argument [...] from incompatible pointer type" warning.
  2014-08-28 15:20 [Bug c/62294] New: Missing "passing argument [...] from incompatible pointer type" warning Emmanuel.Thome at inria dot fr
  2014-09-01 15:33 ` [Bug c/62294] [4.9 Regression] " mpolacek at gcc dot gnu.org
  2014-09-03 12:54 ` mpolacek at gcc dot gnu.org
@ 2014-09-03 12:55 ` mpolacek at gcc dot gnu.org
  2014-09-03 13:21 ` mpolacek at gcc dot gnu.org
  2014-09-03 13:23 ` Emmanuel.Thome at inria dot fr
  4 siblings, 0 replies; 6+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2014-09-03 12:55 UTC (permalink / raw)
  To: gcc-bugs

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

Marek Polacek <mpolacek at gcc dot gnu.org> changed:

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

--- Comment #4 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
Fixed.  I'll add the new test to trunk as well.


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

* [Bug c/62294] [4.9 Regression] Missing "passing argument [...] from incompatible pointer type" warning.
  2014-08-28 15:20 [Bug c/62294] New: Missing "passing argument [...] from incompatible pointer type" warning Emmanuel.Thome at inria dot fr
                   ` (2 preceding siblings ...)
  2014-09-03 12:55 ` mpolacek at gcc dot gnu.org
@ 2014-09-03 13:21 ` mpolacek at gcc dot gnu.org
  2014-09-03 13:23 ` Emmanuel.Thome at inria dot fr
  4 siblings, 0 replies; 6+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2014-09-03 13:21 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #5 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
Author: mpolacek
Date: Wed Sep  3 13:20:43 2014
New Revision: 214876

URL: https://gcc.gnu.org/viewcvs?rev=214876&root=gcc&view=rev
Log:
    PR c/62294
    * gcc.dg/pr62294.c: New test.
    * gcc.dg/pr62294.h: New file.

Added:
    trunk/gcc/testsuite/gcc.dg/pr62294.c
    trunk/gcc/testsuite/gcc.dg/pr62294.h
Modified:
    trunk/gcc/testsuite/ChangeLog


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

* [Bug c/62294] [4.9 Regression] Missing "passing argument [...] from incompatible pointer type" warning.
  2014-08-28 15:20 [Bug c/62294] New: Missing "passing argument [...] from incompatible pointer type" warning Emmanuel.Thome at inria dot fr
                   ` (3 preceding siblings ...)
  2014-09-03 13:21 ` mpolacek at gcc dot gnu.org
@ 2014-09-03 13:23 ` Emmanuel.Thome at inria dot fr
  4 siblings, 0 replies; 6+ messages in thread
From: Emmanuel.Thome at inria dot fr @ 2014-09-03 13:23 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #6 from Emmanuel Thomé <Emmanuel.Thome at inria dot fr> ---
Thanks.

E.
>From gcc-bugs-return-461128-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org Wed Sep 03 14:00:33 2014
Return-Path: <gcc-bugs-return-461128-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org>
Delivered-To: listarch-gcc-bugs@gcc.gnu.org
Received: (qmail 13781 invoked by alias); 3 Sep 2014 14:00:30 -0000
Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm
Precedence: bulk
List-Id: <gcc-bugs.gcc.gnu.org>
List-Archive: <http://gcc.gnu.org/ml/gcc-bugs/>
List-Post: <mailto:gcc-bugs@gcc.gnu.org>
List-Help: <mailto:gcc-bugs-help@gcc.gnu.org>
Sender: gcc-bugs-owner@gcc.gnu.org
Delivered-To: mailing list gcc-bugs@gcc.gnu.org
Received: (qmail 13712 invoked by uid 48); 3 Sep 2014 14:00:20 -0000
From: "rguenth at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug other/63155] [4.9/5 Regression] memory hog
Date: Wed, 03 Sep 2014 14:00:00 -0000
X-Bugzilla-Reason: CC
X-Bugzilla-Type: changed
X-Bugzilla-Watch-Reason: None
X-Bugzilla-Product: gcc
X-Bugzilla-Component: other
X-Bugzilla-Version: 4.9.0
X-Bugzilla-Keywords:
X-Bugzilla-Severity: normal
X-Bugzilla-Who: rguenth at gcc dot gnu.org
X-Bugzilla-Status: NEW
X-Bugzilla-Priority: P3
X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org
X-Bugzilla-Target-Milestone: 4.9.2
X-Bugzilla-Flags:
X-Bugzilla-Changed-Fields: bug_status cf_reconfirmed_on target_milestone everconfirmed
Message-ID: <bug-63155-4-z4DM3vJteE@http.gcc.gnu.org/bugzilla/>
In-Reply-To: <bug-63155-4@http.gcc.gnu.org/bugzilla/>
References: <bug-63155-4@http.gcc.gnu.org/bugzilla/>
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: 7bit
X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/
Auto-Submitted: auto-generated
MIME-Version: 1.0
X-SW-Source: 2014-09/txt/msg00962.txt.bz2
Content-length: 2569

https://gcc.gnu.org/bugzilla/show_bug.cgi?idc155

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2014-09-03
   Target Milestone|---                         |4.9.2
     Ever confirmed|0                           |1

--- Comment #1 from Richard Biener <rguenth at gcc dot gnu.org> ---
Clearly caused by the correctness fix for setjmp to wire abnormal edges.

For me it is out-of-ssa which uses too much memory while building
the conflict graph.

We have gigantic PHI nodes here:

_10263(ab) = PHI <_109925(D)(ab)(2),...., _10592(ab)(1489)>

it's fast when optimizing.

At -O0 we have a _lot_ more anonymous SSA names.

-O1:

  <bb 4>:
  # _1(ab) = PHI <_1902(3), _2(ab)(5)>
  _1905 = _setjmp (_1(ab));
  if (_1905 == 0)
    goto <bb 6>;
  else
    goto <bb 8>;

  <bb 5>
  # _2(ab) = PHI <_1895(D), .... single gigantic PHI

-O0:

  <bb 4>:
  # _1(ab) = PHI <_398164(3), _2(ab)(5)>
  # _632(ab) = PHI <_397532(D)(ab)(3), _633(ab)(5)>
  # _1263(ab) = PHI <_397533(D)(ab)(3), _1264(ab)(5)>
  # _1894(ab) = PHI <_397534(D)(ab)(3), _1895(ab)(5)>
  # _2525(ab) = PHI <_397535(D)(ab)(3), _2526(ab)(5)>
...
  # _396900(ab) = PHI <_398160(D)(ab)(3), _396901(ab)(5)>
  _398165 = _setjmp (_1(ab));
  if (_398165 == 0)
    goto <bb 6>;
  else
    goto <bb 8>;

  <bb 5>
  # _2(ab) = PHI <_397531(D)(ab)(2)...
....
  # _396901(ab) = PHI <_398160(D)(ab)(2), _3...

gazillion of gigantic PHIs.  And very many PHIs in every block.

It's into-SSA that introduces the difference for the PHI nodes
but already GIMPLIFICATION that introduces very many more
temporaries which is the underlying issue (lookup_tmp_var
!optimize check).

Index: gcc/gimplify.c
==================================================================--- gcc/gimplify.c      (revision 214810)
+++ gcc/gimplify.c      (working copy)
@@ -476,7 +476,7 @@ lookup_tmp_var (tree val, bool is_formal
      block, which means it will go into memory, causing much extra
      work in reload and final and poorer code generation, outweighing
      the extra memory allocation here.  */
-  if (!optimize || !is_formal || TREE_SIDE_EFFECTS (val))
+  if (!is_formal || TREE_SIDE_EFFECTS (val))
     ret = create_tmp_from_val (val);
   else
     {

fixes it (but it means that changing the testcase to use more distinct
user variables would produce the same issue even when optimizing).


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

end of thread, other threads:[~2014-09-03 13:23 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-08-28 15:20 [Bug c/62294] New: Missing "passing argument [...] from incompatible pointer type" warning Emmanuel.Thome at inria dot fr
2014-09-01 15:33 ` [Bug c/62294] [4.9 Regression] " mpolacek at gcc dot gnu.org
2014-09-03 12:54 ` mpolacek at gcc dot gnu.org
2014-09-03 12:55 ` mpolacek at gcc dot gnu.org
2014-09-03 13:21 ` mpolacek at gcc dot gnu.org
2014-09-03 13:23 ` Emmanuel.Thome at inria dot fr

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