public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/60760] New: arithmetic on null pointers should not be allowed in constant expressions
@ 2014-04-04 14:53 redi at gcc dot gnu.org
  2014-04-04 17:43 ` [Bug c++/60760] " daniel.kruegler at googlemail dot com
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: redi at gcc dot gnu.org @ 2014-04-04 14:53 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 60760
           Summary: arithmetic on null pointers should not be allowed in
                    constant expressions
           Product: gcc
           Version: 4.9.0
            Status: UNCONFIRMED
          Keywords: accepts-invalid
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: redi at gcc dot gnu.org

G++ should not compile this:

constexpr int* ptr = nullptr;
constexpr int* ptr2 = ptr + 1;


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

* [Bug c++/60760] arithmetic on null pointers should not be allowed in constant expressions
  2014-04-04 14:53 [Bug c++/60760] New: arithmetic on null pointers should not be allowed in constant expressions redi at gcc dot gnu.org
@ 2014-04-04 17:43 ` daniel.kruegler at googlemail dot com
  2014-04-04 18:08 ` daniel.kruegler at googlemail dot com
  2014-12-14 16:27 ` ville.voutilainen at gmail dot com
  2 siblings, 0 replies; 4+ messages in thread
From: daniel.kruegler at googlemail dot com @ 2014-04-04 17:43 UTC (permalink / raw)
  To: gcc-bugs

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

Daniel Krügler <daniel.kruegler at googlemail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |daniel.kruegler@googlemail.
                   |                            |com

--- Comment #1 from Daniel Krügler <daniel.kruegler at googlemail dot com> ---
Agreed. But it should still be possible to add the additive identity (The core
language drafted to support this):

constexpr int* ptr = nullptr;
constexpr int x = 0;
constexpr int* ptr2 = ptr + x;
>From gcc-bugs-return-448322-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org Fri Apr 04 17:53:59 2014
Return-Path: <gcc-bugs-return-448322-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org>
Delivered-To: listarch-gcc-bugs@gcc.gnu.org
Received: (qmail 30240 invoked by alias); 4 Apr 2014 17:53:59 -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 30198 invoked by uid 48); 4 Apr 2014 17:53:56 -0000
From: "redi at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug c++/60760] arithmetic on null pointers should not be allowed in constant expressions
Date: Fri, 04 Apr 2014 17:53: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.0
X-Bugzilla-Keywords: accepts-invalid
X-Bugzilla-Severity: normal
X-Bugzilla-Who: redi at gcc dot gnu.org
X-Bugzilla-Status: UNCONFIRMED
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:
Message-ID: <bug-60760-4-DQ2cWD2oYY@http.gcc.gnu.org/bugzilla/>
In-Reply-To: <bug-60760-4@http.gcc.gnu.org/bugzilla/>
References: <bug-60760-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-04/txt/msg00342.txt.bz2
Content-length: 326

http://gcc.gnu.org/bugzilla/show_bug.cgi?id`760

--- Comment #2 from Jonathan Wakely <redi at gcc dot gnu.org> ---
Yes, we rely on that in initializer_list<>::end(), and clang rejects that.

I discussed that case with Jason and we think [expr.add] could be clarified -
do you have an existing issue number related to that?


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

* [Bug c++/60760] arithmetic on null pointers should not be allowed in constant expressions
  2014-04-04 14:53 [Bug c++/60760] New: arithmetic on null pointers should not be allowed in constant expressions redi at gcc dot gnu.org
  2014-04-04 17:43 ` [Bug c++/60760] " daniel.kruegler at googlemail dot com
@ 2014-04-04 18:08 ` daniel.kruegler at googlemail dot com
  2014-12-14 16:27 ` ville.voutilainen at gmail dot com
  2 siblings, 0 replies; 4+ messages in thread
From: daniel.kruegler at googlemail dot com @ 2014-04-04 18:08 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #3 from Daniel Krügler <daniel.kruegler at googlemail dot com> ---
(In reply to Jonathan Wakely from comment #2)
> Yes, we rely on that in initializer_list<>::end(), and clang rejects that.

<nod>

> I discussed that case with Jason and we think [expr.add] could be clarified
> - do you have an existing issue number related to that?

I haven't - I myself found the existing wording always clear in that regard.
>From gcc-bugs-return-448326-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org Fri Apr 04 18:36:53 2014
Return-Path: <gcc-bugs-return-448326-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org>
Delivered-To: listarch-gcc-bugs@gcc.gnu.org
Received: (qmail 14442 invoked by alias); 4 Apr 2014 18:36:53 -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 14405 invoked by uid 48); 4 Apr 2014 18:36:50 -0000
From: "mikael at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug fortran/60718] Test case gfortran.dg/select_type_4.f90 fails on ARM
Date: Fri, 04 Apr 2014 18:36:00 -0000
X-Bugzilla-Reason: CC
X-Bugzilla-Type: changed
X-Bugzilla-Watch-Reason: None
X-Bugzilla-Product: gcc
X-Bugzilla-Component: fortran
X-Bugzilla-Version: 4.9.0
X-Bugzilla-Keywords:
X-Bugzilla-Severity: normal
X-Bugzilla-Who: mikael at gcc dot gnu.org
X-Bugzilla-Status: UNCONFIRMED
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: cc
Message-ID: <bug-60718-4-NR26RJSo2e@http.gcc.gnu.org/bugzilla/>
In-Reply-To: <bug-60718-4@http.gcc.gnu.org/bugzilla/>
References: <bug-60718-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-04/txt/msg00346.txt.bz2
Content-length: 1083

http://gcc.gnu.org/bugzilla/show_bug.cgi?id`718

Mikael Morin <mikael at gcc dot gnu.org> changed:

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

--- Comment #7 from Mikael Morin <mikael at gcc dot gnu.org> ---
(In reply to Bernd Edlinger from comment #6)
> hmm,
>
> gfc_build_class_symbol creates different types,
> if a class has the allocatable, target or pointer attribute.
>
[...]
>
> But the class(xxx), pointer is passed to class(xxx), target when
> used as a procedure parameter. this makes one type alias another.
>
> maybe the test case is wrong, passing one flavor of object to
> another?
>
This is not a problem; a pointer has the target attribute.
In fortran pointers are not first class citizens, so a pointer variable is the
pointer's target.

I would say that gfc_build_class_symbol should look at the attr->target instead
of attr->pointer, but I don't know how much fallout would come from that.


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

* [Bug c++/60760] arithmetic on null pointers should not be allowed in constant expressions
  2014-04-04 14:53 [Bug c++/60760] New: arithmetic on null pointers should not be allowed in constant expressions redi at gcc dot gnu.org
  2014-04-04 17:43 ` [Bug c++/60760] " daniel.kruegler at googlemail dot com
  2014-04-04 18:08 ` daniel.kruegler at googlemail dot com
@ 2014-12-14 16:27 ` ville.voutilainen at gmail dot com
  2 siblings, 0 replies; 4+ messages in thread
From: ville.voutilainen at gmail dot com @ 2014-12-14 16:27 UTC (permalink / raw)
  To: gcc-bugs

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

Ville Voutilainen <ville.voutilainen at gmail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2014-12-14
                 CC|                            |ville.voutilainen at gmail dot com
     Ever confirmed|0                           |1
      Known to fail|                            |4.8.2, 4.9.1, 5.0


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

end of thread, other threads:[~2014-12-14 16:27 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-04-04 14:53 [Bug c++/60760] New: arithmetic on null pointers should not be allowed in constant expressions redi at gcc dot gnu.org
2014-04-04 17:43 ` [Bug c++/60760] " daniel.kruegler at googlemail dot com
2014-04-04 18:08 ` daniel.kruegler at googlemail dot com
2014-12-14 16:27 ` ville.voutilainen at gmail 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).