public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/63732] New: constexpr is not constant expression, when cast member data pointer to data parent type
@ 2014-11-04  9:37 pavel.kral at omsquare dot com
  2014-11-04 20:44 ` [Bug c++/63732] " daniel.kruegler at googlemail dot com
  2014-11-04 21:37 ` pavel.kral at omsquare dot com
  0 siblings, 2 replies; 3+ messages in thread
From: pavel.kral at omsquare dot com @ 2014-11-04  9:37 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 63732
           Summary: constexpr is not constant expression, when cast member
                    data pointer to data parent type
           Product: gcc
           Version: 4.9.2
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: pavel.kral at omsquare dot com

The code bellow returns error on 4.9.2 (and cause ICE on 4.8.x) tested on
Linux, MinGW and arm-none-eabi. While 'xxx' compiles just fine, 'yyy' which is
casted to parent type doesn't. Just for clarification static const array
'm_members' compiles fine and generate values at compile time in .rodata
section as expected (arm-none-eabi).

class PropertyBase {};
class Number : PropertyBase {};

class ComplexProperty : PropertyBase {
public:
    Number m_firstNumber;
    static PropertyBase ComplexProperty::* const m_members[];

    // compiles fine
    static constexpr auto xxx = (Number
ComplexProperty::*)&ComplexProperty::m_firstNumber;

    //  error: '(PropertyBase
ComplexProperty::*)&ComplexProperty::m_firstNumber' is not a constant
expression
    static constexpr auto yyy = (PropertyBase
ComplexProperty::*)&ComplexProperty::m_firstNumber;
};

// compiles fine
PropertyBase ComplexProperty::* const ComplexProperty::m_members[] = {
        (PropertyBase ComplexProperty::*) &ComplexProperty::m_firstNumber
};

static ComplexProperty person;

int main() {

}


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

* [Bug c++/63732] constexpr is not constant expression, when cast member data pointer to data parent type
  2014-11-04  9:37 [Bug c++/63732] New: constexpr is not constant expression, when cast member data pointer to data parent type pavel.kral at omsquare dot com
@ 2014-11-04 20:44 ` daniel.kruegler at googlemail dot com
  2014-11-04 21:37 ` pavel.kral at omsquare dot com
  1 sibling, 0 replies; 3+ messages in thread
From: daniel.kruegler at googlemail dot com @ 2014-11-04 20:44 UTC (permalink / raw)
  To: gcc-bugs

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

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> ---
I disagree with your interpretation. Note that in your code example for yyy
there is an effective C-cast or reinterpret_cast. This is so, because your are
attempting to convert an address to a pointer of member of type

Number ComplexProperty::*

to

PropertyBase ComplexProperty::*

Irrespective of the private base classes, this kind of pointer conversion is
not allowed without a reinterpret_cast, but reinterpret_casts are not valid in
constants expressions.

The conversion to xxx is valid, because there is no type change involved
(Number ComplexProperty::* is converted to Number ComplexProperty::*) and for
the out-of-class member ComplexProperty::m_members definition the code is
well-formed, because you do have an effective reinterpret_cast but not in a
place where a constant expression would be required.
>From gcc-bugs-return-465746-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org Tue Nov 04 20:52:24 2014
Return-Path: <gcc-bugs-return-465746-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org>
Delivered-To: listarch-gcc-bugs@gcc.gnu.org
Received: (qmail 31214 invoked by alias); 4 Nov 2014 20:52:24 -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 31155 invoked by uid 48); 4 Nov 2014 20:52:20 -0000
From: "rguenth at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug regression/61887] vect.exp UNRESOLVED tests
Date: Tue, 04 Nov 2014 20:52:00 -0000
X-Bugzilla-Reason: CC
X-Bugzilla-Type: changed
X-Bugzilla-Watch-Reason: None
X-Bugzilla-Product: gcc
X-Bugzilla-Component: regression
X-Bugzilla-Version: 5.0
X-Bugzilla-Keywords:
X-Bugzilla-Severity: normal
X-Bugzilla-Who: rguenth at gcc dot gnu.org
X-Bugzilla-Status: RESOLVED
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: bug_status resolution
Message-ID: <bug-61887-4-PEFoPJkvqi@http.gcc.gnu.org/bugzilla/>
In-Reply-To: <bug-61887-4@http.gcc.gnu.org/bugzilla/>
References: <bug-61887-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-11/txt/msg00218.txt.bz2
Content-length: 429

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

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

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

--- Comment #4 from Richard Biener <rguenth at gcc dot gnu.org> ---
Indeed.


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

* [Bug c++/63732] constexpr is not constant expression, when cast member data pointer to data parent type
  2014-11-04  9:37 [Bug c++/63732] New: constexpr is not constant expression, when cast member data pointer to data parent type pavel.kral at omsquare dot com
  2014-11-04 20:44 ` [Bug c++/63732] " daniel.kruegler at googlemail dot com
@ 2014-11-04 21:37 ` pavel.kral at omsquare dot com
  1 sibling, 0 replies; 3+ messages in thread
From: pavel.kral at omsquare dot com @ 2014-11-04 21:37 UTC (permalink / raw)
  To: gcc-bugs

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain; charset="UTF-8", Size: 4509 bytes --]

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

Pavel Král <pavel.kral at omsquare dot com> changed:

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

--- Comment #2 from Pavel Král <pavel.kral at omsquare dot com> ---
Hi Daniel,

your are right about effective reintepret_cast<>, thanks for clarification.

Best Regards,
Pavel
>From gcc-bugs-return-465752-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org Tue Nov 04 21:57:42 2014
Return-Path: <gcc-bugs-return-465752-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org>
Delivered-To: listarch-gcc-bugs@gcc.gnu.org
Received: (qmail 2675 invoked by alias); 4 Nov 2014 21:57:42 -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 2647 invoked by uid 48); 4 Nov 2014 21:57:38 -0000
From: "joel at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug debug/63741] New: lm32 ICE in dwarf2out_frame_debug_expr, at dwarf2cfi.c:1677
Date: Tue, 04 Nov 2014 21:57:00 -0000
X-Bugzilla-Reason: CC
X-Bugzilla-Type: new
X-Bugzilla-Watch-Reason: None
X-Bugzilla-Product: gcc
X-Bugzilla-Component: debug
X-Bugzilla-Version: 4.9.2
X-Bugzilla-Keywords:
X-Bugzilla-Severity: normal
X-Bugzilla-Who: joel 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: bug_id short_desc product version bug_status bug_severity priority component assigned_to reporter attachments.created
Message-ID: <bug-63741-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-11/txt/msg00224.txt.bz2
Content-length: 2140

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

            Bug ID: 63741
           Summary: lm32 ICE in dwarf2out_frame_debug_expr, at
                    dwarf2cfi.c:1677
           Product: gcc
           Version: 4.9.2
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: debug
          Assignee: unassigned at gcc dot gnu.org
          Reporter: joel at gcc dot gnu.org

Created attachment 33886
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id3886&actioníit
Preprocessed RTEMS fastlz.c which produces the error.

The attached preprocessed code gives an ICE at -O0, -O1, -O2, and -0s. Dropping
the -g gets by the ICE so this seems like  a debug info issue.

lm32-rtems4.11-gcc -O0 -g  -c fastlz.c


lm32-rtems4.11-gcc --pipe -DHAVE_CONFIG_H   -I..
-I../../cpukit/../../../milkymist/lib/include -DRTEMS_RTL_RAP_LOADER=1
-DRTEMS_RTL_ELF_LOADER=1   -mbarrel-shift-enabled -mmultiply-enabled
-mdivide-enabled -msign-extend-enabled -O2 -g -Wall -Wmissing-prototypes
-Wimplicit-function-declaration -Wstrict-prototypes -Wnested-externs -MT
libdl_a-fastlz.o -MD -MP -MF .deps/libdl_a-fastlz.Tpo -c -o libdl_a-fastlz.o
`test -f 'fastlz.c' || echo
'../../../../../../rtems/c/src/../../cpukit/libdl/'`fastlz.c
In file included from
../../../../../../rtems/c/src/../../cpukit/libdl/fastlz.c:113:0:
../../../../../../rtems/c/src/../../cpukit/libdl/fastlz.c: In function
'fastlz1_compress':
../../../../../../rtems/c/src/../../cpukit/libdl/fastlz.c:418:1: internal
compiler error: in dwarf2out_frame_debug_expr, at dwarf2cfi.c:1677
 }
 ^
0x52e8b6 dwarf2out_frame_debug_expr
    ../../gcc-4.9.1/gcc/dwarf2cfi.c:1675
0x52ef6c dwarf2out_frame_debug
    ../../gcc-4.9.1/gcc/dwarf2cfi.c:2043
0x52ef6c scan_insn_after
    ../../gcc-4.9.1/gcc/dwarf2cfi.c:2369
0x5307d2 scan_trace
    ../../gcc-4.9.1/gcc/dwarf2cfi.c:2526
0x5311d5 create_cfi_notes
    ../../gcc-4.9.1/gcc/dwarf2cfi.c:2565
0x5311d5 execute_dwarf2_frame
    ../../gcc-4.9.1/gcc/dwarf2cfi.c:2925
0x5311d5 execute
    ../../gcc-4.9.1/gcc/dwarf2cfi.c:3421
Please submit a full bug report,
with preprocessed source if appropriate.


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

end of thread, other threads:[~2014-11-04 21:37 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-11-04  9:37 [Bug c++/63732] New: constexpr is not constant expression, when cast member data pointer to data parent type pavel.kral at omsquare dot com
2014-11-04 20:44 ` [Bug c++/63732] " daniel.kruegler at googlemail dot com
2014-11-04 21:37 ` pavel.kral at omsquare 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).