* [Bug c++/57599] g++ accepts invalid dynamic_cast of a const type to a regular type
2013-06-12 16:30 [Bug c++/57599] New: g++ accepts invalid dynamic_cast of a const type to a regular type abel at gcc dot gnu.org
@ 2013-06-12 16:35 ` redi at gcc dot gnu.org
2013-06-12 16:38 ` [Bug c++/57599] g++ accepts invalid assignment of a dynamic_cast<const A*> to A* abel at gcc dot gnu.org
` (6 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: redi at gcc dot gnu.org @ 2013-06-12 16:35 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57599
--- Comment #1 from Jonathan Wakely <redi at gcc dot gnu.org> ---
The summary is very misleading. You're not casting a const type to a non-const
type, you're casting a non-const type to a const type, then assigning that to a
non-const type.
What actually happens is that dynamic_cast<const A*>(b) returns A*
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug c++/57599] g++ accepts invalid assignment of a dynamic_cast<const A*> to A*
2013-06-12 16:30 [Bug c++/57599] New: g++ accepts invalid dynamic_cast of a const type to a regular type abel at gcc dot gnu.org
2013-06-12 16:35 ` [Bug c++/57599] " redi at gcc dot gnu.org
@ 2013-06-12 16:38 ` abel at gcc dot gnu.org
2013-06-12 23:34 ` [Bug c++/57599] result of dynamic_cast<cv T> is just T paolo.carlini at oracle dot com
` (5 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: abel at gcc dot gnu.org @ 2013-06-12 16:38 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57599
Andrey Belevantsev <abel at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Summary|g++ accepts invalid |g++ accepts invalid
|dynamic_cast of a const |assignment of a
|type to a regular type |dynamic_cast<const A*> to
| |A*
--- Comment #2 from Andrey Belevantsev <abel at gcc dot gnu.org> ---
Sorry, I tried to fix the summary. Feel free to improve it more if needed :)
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug c++/57599] result of dynamic_cast<cv T> is just T
2013-06-12 16:30 [Bug c++/57599] New: g++ accepts invalid dynamic_cast of a const type to a regular type abel at gcc dot gnu.org
2013-06-12 16:35 ` [Bug c++/57599] " redi at gcc dot gnu.org
2013-06-12 16:38 ` [Bug c++/57599] g++ accepts invalid assignment of a dynamic_cast<const A*> to A* abel at gcc dot gnu.org
@ 2013-06-12 23:34 ` paolo.carlini at oracle dot com
2013-06-13 6:59 ` daniel.kruegler at googlemail dot com
` (4 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: paolo.carlini at oracle dot com @ 2013-06-12 23:34 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57599
Paolo Carlini <paolo.carlini at oracle dot com> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |ASSIGNED
Last reconfirmed| |2013-06-12
Assignee|unassigned at gcc dot gnu.org |paolo.carlini at oracle dot com
Ever confirmed|0 |1
--- Comment #3 from Paolo Carlini <paolo.carlini at oracle dot com> ---
On it.
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug c++/57599] result of dynamic_cast<cv T> is just T
2013-06-12 16:30 [Bug c++/57599] New: g++ accepts invalid dynamic_cast of a const type to a regular type abel at gcc dot gnu.org
` (2 preceding siblings ...)
2013-06-12 23:34 ` [Bug c++/57599] result of dynamic_cast<cv T> is just T paolo.carlini at oracle dot com
@ 2013-06-13 6:59 ` daniel.kruegler at googlemail dot com
2013-06-13 7:03 ` abel at gcc dot gnu.org
` (3 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: daniel.kruegler at googlemail dot com @ 2013-06-13 6:59 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57599
Daniel Krügler <daniel.kruegler at googlemail dot com> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |daniel.kruegler@googlemail.
| |com
--- Comment #4 from Daniel Krügler <daniel.kruegler at googlemail dot com> ---
I created a test case for all type conversion operators:
struct A {};
struct B : public A {};
template<class, class>
struct is_same { static constexpr bool value = false; };
template<class T>
struct is_same<T, T> { static constexpr bool value = true; };
template<class T>
T val();
static_assert(is_same<decltype(static_cast<const A*>(val<B*>())), const
A*>::value, "Ouch");
static_assert(is_same<decltype(static_cast<const A&>(val<B&>())), const
A&>::value, "Ouch");
static_assert(is_same<decltype(const_cast<const A*>(val<A*>())), const
A*>::value, "Ouch");
static_assert(is_same<decltype(const_cast<const A&>(val<A&>())), const
A&>::value, "Ouch");
static_assert(is_same<decltype(reinterpret_cast<const A*>(val<B*>())), const
A*>::value, "Ouch");
static_assert(is_same<decltype(reinterpret_cast<const A&>(val<B&>())), const
A&>::value, "Ouch");
static_assert(is_same<decltype(dynamic_cast<const A*>(val<B*>())), const
A*>::value, "Ouch"); // Error!
static_assert(is_same<decltype(dynamic_cast<const A&>(val<B&>())), const
A&>::value, "Ouch"); // Error!
In agreement with that bug report I see failures for the last two even for gcc
4.9.0 20130609 (experimental)
>From gcc-bugs-return-424283-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org Thu Jun 13 07:00:07 2013
Return-Path: <gcc-bugs-return-424283-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org>
Delivered-To: listarch-gcc-bugs@gcc.gnu.org
Received: (qmail 9192 invoked by alias); 13 Jun 2013 07:00:06 -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 9130 invoked by uid 48); 13 Jun 2013 07:00:03 -0000
From: "valeryweber at hotmail dot com" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug fortran/57596] select type bug with optional variables?
Date: Thu, 13 Jun 2013 07:00: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: valeryweber at hotmail dot com
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:
Message-ID: <bug-57596-4-CoXWze0iVG@http.gcc.gnu.org/bugzilla/>
In-Reply-To: <bug-57596-4@http.gcc.gnu.org/bugzilla/>
References: <bug-57596-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: 2013-06/txt/msg00662.txt.bz2
Content-length: 1277
http://gcc.gnu.org/bugzilla/show_bug.cgi?idW596
--- Comment #2 from Valery Weber <valeryweber at hotmail dot com> ---
But the selector is not optional. The problem even remains if I
move the optional variables outside the SELECT TYPE (see bellow).
Those 2 codes run just fine with other compilers like ifort or xlf.
Thanks
Valery
MODULE base_types
TYPE :: base_integer_type
INTEGER :: i
END TYPE base_integer_type
TYPE :: base_character_type
CHARACTER( 10 ) :: c
END TYPE base_character_type
END MODULE base_types
PROGRAM main
USE base_types
IMPLICIT NONE
INTEGER::i_val
call get ( i_val=i_val )
write(*,*) 'i_val',i_val
contains
SUBROUTINE get (i_val, c_val)
INTEGER, INTENT( OUT ), OPTIONAL :: i_val
CHARACTER( : ), INTENT( OUT ), ALLOCATABLE, OPTIONAL :: c_val
CLASS( * ), POINTER :: p
TYPE( base_integer_type ),target :: i_base
INTEGER :: i_val_tmp
CHARACTER( 10 ) :: c_val_tmp
i_base%i=-12
p=>i_base
SELECT TYPE( p )
TYPE IS( base_integer_type )
i_val_tmp = p%i
TYPE IS( base_character_type )
c_val_tmp = p%c
CLASS DEFAULT
stop
END SELECT
IF(present(i_val)) i_val = i_val_tmp
if(present(c_val)) c_val = c_val_tmp
END SUBROUTINE get
END PROGRAM main
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug c++/57599] result of dynamic_cast<cv T> is just T
2013-06-12 16:30 [Bug c++/57599] New: g++ accepts invalid dynamic_cast of a const type to a regular type abel at gcc dot gnu.org
` (3 preceding siblings ...)
2013-06-13 6:59 ` daniel.kruegler at googlemail dot com
@ 2013-06-13 7:03 ` abel at gcc dot gnu.org
2013-06-14 9:23 ` paolo.carlini at oracle dot com
` (2 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: abel at gcc dot gnu.org @ 2013-06-13 7:03 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57599
--- Comment #5 from Andrey Belevantsev <abel at gcc dot gnu.org> ---
(In reply to Daniel Krügler from comment #4)
> I created a test case for all type conversion operators:
Paolo has already submitted a patch with the expanded test case at
http://gcc.gnu.org/ml/gcc-patches/2013-06/msg00760.html/
>From gcc-bugs-return-424285-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org Thu Jun 13 07:12:36 2013
Return-Path: <gcc-bugs-return-424285-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org>
Delivered-To: listarch-gcc-bugs@gcc.gnu.org
Received: (qmail 15965 invoked by alias); 13 Jun 2013 07:12:35 -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 15897 invoked by uid 48); 13 Jun 2013 07:12:26 -0000
From: "glisse at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug tree-optimization/57601] New: Vector lowering could use larger modes
Date: Thu, 13 Jun 2013 07:12:00 -0000
X-Bugzilla-Reason: CC
X-Bugzilla-Type: new
X-Bugzilla-Watch-Reason: None
X-Bugzilla-Product: gcc
X-Bugzilla-Component: tree-optimization
X-Bugzilla-Version: 4.9.0
X-Bugzilla-Keywords: missed-optimization
X-Bugzilla-Severity: normal
X-Bugzilla-Who: glisse 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 keywords bug_severity priority component assigned_to reporter cf_gcctarget
Message-ID: <bug-57601-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: 2013-06/txt/msg00664.txt.bz2
Content-length: 1077
http://gcc.gnu.org/bugzilla/show_bug.cgi?idW601
Bug ID: 57601
Summary: Vector lowering could use larger modes
Product: gcc
Version: 4.9.0
Status: UNCONFIRMED
Keywords: missed-optimization
Severity: normal
Priority: P3
Component: tree-optimization
Assignee: unassigned at gcc dot gnu.org
Reporter: glisse at gcc dot gnu.org
Target: x86_64-linux-gnu
typedef int vec __attribute__((vector_size(2*sizeof(int))));
vec f(vec a, vec b){
return a-b;
}
vmovq %xmm0, %rcx
vmovq %xmm1, %rdx
movl %ecx, %eax
shrq $32, %rcx
subl %edx, %eax
shrq $32, %rdx
subl %edx, %ecx
vmovd %eax, %xmm2
vpinsrd $1, %ecx, %xmm2, %xmm0
(with -Ofast -mavx2) whereas if I change the size to 4, I get:
vpsubd %xmm1, %xmm0, %xmm0
which seems valid to me even for size 2. It is not clear to me how to model
that at tree level, maybe it would be easier to just implement V2SI operations
in the backend?
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug c++/57599] result of dynamic_cast<cv T> is just T
2013-06-12 16:30 [Bug c++/57599] New: g++ accepts invalid dynamic_cast of a const type to a regular type abel at gcc dot gnu.org
` (4 preceding siblings ...)
2013-06-13 7:03 ` abel at gcc dot gnu.org
@ 2013-06-14 9:23 ` paolo.carlini at oracle dot com
2013-06-14 9:37 ` abel at gcc dot gnu.org
2013-06-14 10:17 ` paolo.carlini at oracle dot com
7 siblings, 0 replies; 9+ messages in thread
From: paolo.carlini at oracle dot com @ 2013-06-14 9:23 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57599
Paolo Carlini <paolo.carlini at oracle dot com> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|ASSIGNED |RESOLVED
Resolution|--- |FIXED
Target Milestone|--- |4.9.0
--- Comment #6 from Paolo Carlini <paolo.carlini at oracle dot com> ---
Fixed for 4.9.0.
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug c++/57599] result of dynamic_cast<cv T> is just T
2013-06-12 16:30 [Bug c++/57599] New: g++ accepts invalid dynamic_cast of a const type to a regular type abel at gcc dot gnu.org
` (5 preceding siblings ...)
2013-06-14 9:23 ` paolo.carlini at oracle dot com
@ 2013-06-14 9:37 ` abel at gcc dot gnu.org
2013-06-14 10:17 ` paolo.carlini at oracle dot com
7 siblings, 0 replies; 9+ messages in thread
From: abel at gcc dot gnu.org @ 2013-06-14 9:37 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57599
--- Comment #7 from Andrey Belevantsev <abel at gcc dot gnu.org> ---
(In reply to Paolo Carlini from comment #6)
> Fixed for 4.9.0.
Do you plan to backport this to 4.7 and 4.8?
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug c++/57599] result of dynamic_cast<cv T> is just T
2013-06-12 16:30 [Bug c++/57599] New: g++ accepts invalid dynamic_cast of a const type to a regular type abel at gcc dot gnu.org
` (6 preceding siblings ...)
2013-06-14 9:37 ` abel at gcc dot gnu.org
@ 2013-06-14 10:17 ` paolo.carlini at oracle dot com
7 siblings, 0 replies; 9+ messages in thread
From: paolo.carlini at oracle dot com @ 2013-06-14 10:17 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57599
--- Comment #8 from Paolo Carlini <paolo.carlini at oracle dot com> ---
No, because isn't a regression. If you care a lot about that, just ask on the
mailing list.
^ permalink raw reply [flat|nested] 9+ messages in thread