* [Bug tree-optimization/85803] [6/7/8/9 Regression] DSE removes live global store
[not found] <bug-85803-4@http.gcc.gnu.org/bugzilla/>
@ 2018-05-16 13:19 ` rguenth at gcc dot gnu.org
2021-05-14 9:50 ` [Bug tree-optimization/85803] [9/10/11/12 " jakub at gcc dot gnu.org
` (6 subsequent siblings)
7 siblings, 0 replies; 8+ messages in thread
From: rguenth at gcc dot gnu.org @ 2018-05-16 13:19 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85803
Richard Biener <rguenth at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Priority|P3 |P2
CC| |ebotcazou at gcc dot gnu.org
Target Milestone|--- |6.5
--- Comment #1 from Richard Biener <rguenth at gcc dot gnu.org> ---
More simple cases involve externally thrown (non-call or from const function)
exceptions like
*p = 42;
a / 0;
*p = 0;
or
*p = 42;
*(void *)0 = 0;
*p = 0;
note that with externally thrown EH we do not have any CFG reflecting the EH
and thus other passes are usually also free in re-ordering stmts to make the
*p = 42 side-effect invisible.
I think the only in-tree language eventually specifying behavior for stuff
like above is Ada - so, any comments / attempts for testcases where we do
not follow language specified behavior?
One idea that crossed our minds is to add a return statement to the exit
block having the virtual operand and have externally throwing stmts have
an EH edge to that block (and a fallthru from the regular exit / return stmt).
>From gcc-bugs-return-604822-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org Wed May 16 13:39:15 2018
Return-Path: <gcc-bugs-return-604822-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org>
Delivered-To: listarch-gcc-bugs@gcc.gnu.org
Received: (qmail 74290 invoked by alias); 16 May 2018 13:39:15 -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 74255 invoked by uid 48); 16 May 2018 13:39:11 -0000
From: "mpolacek at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug c++/85363] Throwing exception from member constructor (brace initializer vs initializer list)
Date: Wed, 16 May 2018 13:39: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: 7.2.1
X-Bugzilla-Keywords: wrong-code
X-Bugzilla-Severity: normal
X-Bugzilla-Who: mpolacek at gcc dot gnu.org
X-Bugzilla-Status: ASSIGNED
X-Bugzilla-Resolution:
X-Bugzilla-Priority: P3
X-Bugzilla-Assigned-To: mpolacek at gcc dot gnu.org
X-Bugzilla-Target-Milestone: ---
X-Bugzilla-Flags:
X-Bugzilla-Changed-Fields: bug_status assigned_to
Message-ID: <bug-85363-4-ABIa5Jmw2H@http.gcc.gnu.org/bugzilla/>
In-Reply-To: <bug-85363-4@http.gcc.gnu.org/bugzilla/>
References: <bug-85363-4@http.gcc.gnu.org/bugzilla/>
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/
Auto-Submitted: auto-generated
MIME-Version: 1.0
X-SW-Source: 2018-05/txt/msg01717.txt.bz2
Content-length: 384
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85363
Marek Polacek <mpolacek at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |ASSIGNED
Assignee|unassigned at gcc dot gnu.org |mpolacek at gcc dot gnu.org
>From gcc-bugs-return-604823-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org Wed May 16 13:39:28 2018
Return-Path: <gcc-bugs-return-604823-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org>
Delivered-To: listarch-gcc-bugs@gcc.gnu.org
Received: (qmail 75119 invoked by alias); 16 May 2018 13:39:27 -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 75084 invoked by uid 48); 16 May 2018 13:39:22 -0000
From: "Casey at Carter dot net" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug c++/85806] New: [concepts] Hard error for "invalid use of non-static data member" in a requires expression
Date: Wed, 16 May 2018 13:39:00 -0000
X-Bugzilla-Reason: CC
X-Bugzilla-Type: new
X-Bugzilla-Watch-Reason: None
X-Bugzilla-Product: gcc
X-Bugzilla-Component: c++
X-Bugzilla-Version: 8.1.0
X-Bugzilla-Keywords:
X-Bugzilla-Severity: normal
X-Bugzilla-Who: Casey at Carter dot net
X-Bugzilla-Status: UNCONFIRMED
X-Bugzilla-Resolution:
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 target_milestone
Message-ID: <bug-85806-4@http.gcc.gnu.org/bugzilla/>
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/
Auto-Submitted: auto-generated
MIME-Version: 1.0
X-SW-Source: 2018-05/txt/msg01718.txt.bz2
Content-length: 1110
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85806
Bug ID: 85806
Summary: [concepts] Hard error for "invalid use of non-static
data member" in a requires expression
Product: gcc
Version: 8.1.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: Casey at Carter dot net
Target Milestone: ---
Compiling this program fragment with g++ -std=c++17 -fconcepts
(https://godbolt.org/g/L1b6TS):
template<int> using helper = void;
template<typename T>
concept bool HasCount = requires {
typename ::helper<T::count>;
};
struct S {
int count = 42;
};
static_assert(!HasCount<S>);
produces a diagnostic:
<source>:11:18: error: invalid use of non-static data member 'S::count'
static_assert(!HasCount<S>);
^~~~~~~~~~~
<source>:9:19: note: declared here
int count = 42;
^~
rather than the expected successful and silent compile.
>From gcc-bugs-return-604824-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org Wed May 16 13:56:28 2018
Return-Path: <gcc-bugs-return-604824-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org>
Delivered-To: listarch-gcc-bugs@gcc.gnu.org
Received: (qmail 21624 invoked by alias); 16 May 2018 13:56:27 -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 20962 invoked by uid 48); 16 May 2018 13:56:22 -0000
From: "peter.azmanov at transas dot com" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug c++/85807] New: ICEs related to noexcept
Date: Wed, 16 May 2018 13:56:00 -0000
X-Bugzilla-Reason: CC
X-Bugzilla-Type: new
X-Bugzilla-Watch-Reason: None
X-Bugzilla-Product: gcc
X-Bugzilla-Component: c++
X-Bugzilla-Version: 8.1.0
X-Bugzilla-Keywords:
X-Bugzilla-Severity: normal
X-Bugzilla-Who: peter.azmanov at transas dot com
X-Bugzilla-Status: UNCONFIRMED
X-Bugzilla-Resolution:
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 target_milestone attachments.created
Message-ID: <bug-85807-4@http.gcc.gnu.org/bugzilla/>
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/
Auto-Submitted: auto-generated
MIME-Version: 1.0
X-SW-Source: 2018-05/txt/msg01719.txt.bz2
Content-length: 3477
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85807
Bug ID: 85807
Summary: ICEs related to noexcept
Product: gcc
Version: 8.1.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: peter.azmanov at transas dot com
Target Milestone: ---
Created attachment 44138
--> https://gcc.gnu.org/bugzilla/attachment.cgi?id=44138&action=edit
self-contained test
After upgrade to version 8.1.0, encountered ICE:
"internal compiler error: in check_noexcept_r, at cp/except.c:1027"
Slight modifications led to other ICEs.
Test script:
echo "==== Segfault internal compiler error"
/usr/bin/g++ -DSEGFAULT_ERROR test.cpp
echo "==== Noexcept internal compiler error"
/usr/bin/g++ -DNOEXCEPT_ERROR test.cpp
echo "==== Unexpected expression internal compiler error"
/usr/bin/g++ -DUNEXPECTED_EXPR_ERROR -Wall test.cpp
echo "==== cp_get_fndecl_from_callee internal compiler error (1)"
/usr/bin/g++ -DUNEXPECTED_EXPR_ERROR test.cpp
echo "==== cp_get_fndecl_from_callee internal compiler error (2)"
/usr/bin/g++ test.cpp
echo "==== Workaround"
/usr/bin/g++ -DWORKAROUND test.cpp
Output:
==== Segfault internal compiler error
test.cpp: In function ‘value_statistics_t<> calc() [with T = double]’:
test.cpp:25:13: internal compiler error: Segmentation fault
return {};
^
Please submit a full bug report,
with preprocessed source if appropriate.
See <https://bugs.archlinux.org/> for instructions.
==== Noexcept internal compiler error
test.cpp: In instantiation of ‘value_statistics_t<> calc() [with T = double]’:
test.cpp:39:46: required from here
test.cpp:28:24: internal compiler error: in check_noexcept_r, at
cp/except.c:1027
value_statistics_t<> result;
^~~~~~
Please submit a full bug report,
with preprocessed source if appropriate.
See <https://bugs.archlinux.org/> for instructions.
==== Unexpected expression internal compiler error
test.cpp: In instantiation of ‘value_statistics_t<> calc() [with T = double]’:
test.cpp:39:46: required from here
test.cpp:31:31: internal compiler error: unexpected expression ‘(size_t)0’ of
kind implicit_conv_expr
return value_statistics_t<>{};
^
Please submit a full bug report,
with preprocessed source if appropriate.
See <https://bugs.archlinux.org/> for instructions.
==== cp_get_fndecl_from_callee internal compiler error (1)
test.cpp: In instantiation of ‘value_statistics_t<> calc() [with T = double]’:
test.cpp:39:46: required from here
test.cpp:35:1: internal compiler error: in cp_get_fndecl_from_callee, at
cp/cvt.c:957
}
^
Please submit a full bug report,
with preprocessed source if appropriate.
See <https://bugs.archlinux.org/> for instructions.
==== cp_get_fndecl_from_callee internal compiler error (2)
test.cpp: In instantiation of ‘value_statistics_t<> calc() [with T = double]’:
test.cpp:39:46: required from here
test.cpp:35:1: internal compiler error: in cp_get_fndecl_from_callee, at
cp/cvt.c:957
}
^
Please submit a full bug report,
with preprocessed source if appropriate.
See <https://bugs.archlinux.org/> for instructions.
==== Workaround
>From gcc-bugs-return-604825-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org Wed May 16 13:58:32 2018
Return-Path: <gcc-bugs-return-604825-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org>
Delivered-To: listarch-gcc-bugs@gcc.gnu.org
Received: (qmail 106519 invoked by alias); 16 May 2018 13:58:32 -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 106006 invoked by uid 89); 16 May 2018 13:58:31 -0000
Authentication-Results: sourceware.org; auth=none
X-Virus-Found: No
X-Spam-SWARE-Status: No, score=-1.9 required=5.0 tests=AWL,BAYES_00,FREEMAIL_FROM,RCVD_IN_DNSWL_NONE,SPF_PASS autolearn=ham version=3.3.2 spammy=dias, Wilson, tC, HX-Received:sk:g10-v6m
X-HELO: mail-ot0-f196.google.com
Received: from mail-ot0-f196.google.com (HELO mail-ot0-f196.google.com) (74.125.82.196) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Wed, 16 May 2018 13:58:30 +0000
Received: by mail-ot0-f196.google.com with SMTP id n1-v6so997272otf.7 for <gcc-bugs@gcc.gnu.org>; Wed, 16 May 2018 06:58:30 -0700 (PDT)
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d\x1e100.net; s 161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc:content-transfer-encoding; bh=khnKwcwJFFWB0l+yAV75p9Bl7k5LPO3a3fRiBnXriyk=; b=OtudxHw6xjIMHU5itnBQlMqv5sTshUdLyMIsbKU7sZLDI4JZfjfF5RX0sZ03ruS4yd oqnFNvDwofeQF+iFuryGELrrt1rkbWRNMQOC28IlGpmJRYIlePro3PrcM/tHhLdH/0z0 NfxAIDCYnWnfyF6He0RQkzxK/KMPpwTzAk9ZmAB7lDZ9NpXuOOPobzm0vita6jNsReZE htQMrwv9ef9ca7tLg7ZYH+kwc5nMAoDikGOZsrvarN+1aWgORMDvRsdsv72P7HkaSCNM 4e7+xdB9ES+V/KECsUELCgRPaG7h1/hcFNdFpo3OV8Bk9TqgJfideYpHybtdo7Mpx0qw PBVQ=X-Gm-Message-State: ALKqPwfg56rp6DqDQ9Wurt3+2wyNgQvP0dvye9DgZr3SoRN6T0viUJMG A63UqH09a5AmdFBDoDbSbmKF17bhhdcScmuO8S0X-Google-Smtp-Source: AB8JxZorJOdXbaJBCQVU4MZCXP5el1/IpYKwKhEjGSonWtH+LobYYQhzqff1CJQrv+Kc5iKoBGWwGk6zOYeck7nmjksX-Received: by 2002:a9d:620a:: with SMTP id g10-v6mr722142otj.288.1526479108495; Wed, 16 May 2018 06:58:28 -0700 (PDT)
MIME-Version: 1.0
Received: by 10.74.211.138 with HTTP; Wed, 16 May 2018 06:58:27 -0700 (PDT)
In-Reply-To: <f0aa39a7-cdae-764c-3273-298a96899261@sifive.com>
References: <o9iac8sg.fsf@gmail.com> <f0aa39a7-cdae-764c-3273-298a96899261@sifive.com>
From: Jason Vas Dias <jason.vas.dias@gmail.com>
Date: Wed, 16 May 2018 13:58:00 -0000
Message-ID: <CALyZvKw+JE+WP8KvNZQLOt-h6Ymr_4it7KX2xvOY4heQ4G3y_g@mail.gmail.com>
Subject: Re: bug ? : -Wpedantic -Wconversion 'short a=1; a-=1;' complaint
To: Jim Wilson <jimw@sifive.com>
Cc: gcc-bugs@gcc.gnu.org, gcc@gcc.org
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
X-IsSubscribed: yes
X-SW-Source: 2018-05/txt/msg01720.txt.bz2
Content-length: 3732
Great thanks for your informative response, Jim! :
RE:
On 23/04/2018, Jim Wilson <jimw@sifive.com> wrote:
> On 04/23/2018 07:11 AM, Jason Vas Dias wrote:
>>
>> I really do not think a '-Wpedantic -Wconversion' warning should
>> be generated for the following code, but it is
>> (with GCC 6.4.1 and 7.3.1 on RHEL-7.5 Linux) :
>>
>> $ echo '
>> typedef unsigned short U16_t;
>> static void f(void)
>> { U16_t a = 1;
>> a-=1;
>> }' > t.C;
>
> gcc@gcc.gnu.org dropped as inappropriate. Note that gcc-bugs is output
> from our bugzilla. Sending email here isn't very useful. If you want a
> bug fixed, you have to open a bug report in bugzilla. You can ask gcc
> questions on gcc help.
>
> In the C language, operations on short and always performed as int, and
> then converted back to short. Subtracting one may generated a negative
> number, which converted to unsigned short will change its value. So the
> warning seems appropriate.
>
> Note that -Wconversion means different things in different gcc versions.
> It current meaning is to warn for any implicit cast that may change a
> value. This is not very useful in general, and is not an option that I
> would recommend using by default. In old gcc versions, -Wconversion
> warned for code that had different meaning in K&R C and ISO C. That was
> useful, and some people used that option by default, but the option no
> longer does that.
>
> You can silence the warning by adding an explicit cast.
> a = (U16_t) (a - 1);
>
> Jim
>
But I still think, in modern GCC, the behaviour of this warning option is a bug.
When I look at the code generated for the above example, I can see
the compiler is actually generating 16-bit operations:
$ gcc -std=c11 -Wall -Wextra -pedantic -Wconversion -S -o u16.s u16.c
u16.c: In function ‘f’:
u16.c:9:6: warning: conversion to ‘U16_t {aka short unsigned int}’
from ‘int’ may alter its value [-Wconversion]
v-=1;
^
But looking at the assembler generated :
movw $1, -2(%rbp)
subw $1, -2(%rbp)
we see that on x86_64 at least, the compiler is actually generating
16-bit operations on two-byte values.
I can understand that on architectures such as ARM , it might be
appropriate to generate the warning, because on that platform,
a 32-bit operation may actually be generated for the code.
But if no 32-bit operation is being generated, why issue the warning?
So it is not the case that
> In the C language, operations on short are always performed as int, and
> then converted back to short .
That may have been true with ANSI C90, but not with more recent versions
of the C language; surely GCC should know what standard & CPU it is generating
code for, and emit appropriate warnings for that standard and CPU ?
And your suggested fix illustrates my point about the warning encouraging
unnecessary casts:
> You can silence the warning by adding an explicit cast.
> a = (U16_t) (a - 1);
Actually, in this case, gcc is clever enough to realize that a cast is
not required,
and actually generates identical code with or without the cast:
movw $1, -2(%rbp)
subw $1, -2(%rbp)
But C++ programmers are encouraged to look at any C-style "(X)y" cast as
"Create an anonymous Temporary to hold y cast to type X " .
Even though that is not what is going on here, I think the warning does
not help programmers understand what code is being generated
(the 16-bit operations) and incorrectly makes them think a 32-bit
temporary is being generated.
So I think that '-Wconversion' should have no effect if '-pedantic'
is in effect,
because that combination produces erroneous and misleading warnings .
Thanks & Best Regards,
Jason
^ permalink raw reply [flat|nested] 8+ messages in thread