* [Bug c/67279] -fsanitize=undefined spurious error: initializer element is not constant
2015-08-19 17:06 [Bug c/67279] New: -fsanitize=undefined spurious error: initializer element is not constant zeccav at gmail dot com
@ 2015-08-19 17:09 ` mpolacek at gcc dot gnu.org
2015-08-19 18:59 ` zeccav at gmail dot com
` (6 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2015-08-19 17:09 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67279
Marek Polacek <mpolacek at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |mpolacek at gcc dot gnu.org
--- Comment #1 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
Yes, because 1 << 31 is UB in C99/C11.
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug c/67279] -fsanitize=undefined spurious error: initializer element is not constant
2015-08-19 17:06 [Bug c/67279] New: -fsanitize=undefined spurious error: initializer element is not constant zeccav at gmail dot com
2015-08-19 17:09 ` [Bug c/67279] " mpolacek at gcc dot gnu.org
@ 2015-08-19 18:59 ` zeccav at gmail dot com
2015-08-19 19:33 ` zeccav at gmail dot com
` (5 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: zeccav at gmail dot com @ 2015-08-19 18:59 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67279
--- Comment #2 from Vittorio Zecca <zeccav at gmail dot com> ---
UB = undefined behaviour?
Why then it is only signaled if "static" attribute is requested?
This is accepted:"int dec_1 = 1 << 31;"
Isn't UB as well if it is not static?
I believe gcc should deliver a warning, and then a "runtime error"
message at runtime.
In other words codes that compile with gcc should still compile with
-fsanitize=undefined
This example comes from wine and it is annoying to recompile the codes
that exhibit
this error message.
Also, the message is misleading, it should say that the initializer is
undefined.
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug c/67279] -fsanitize=undefined spurious error: initializer element is not constant
2015-08-19 17:06 [Bug c/67279] New: -fsanitize=undefined spurious error: initializer element is not constant zeccav at gmail dot com
2015-08-19 17:09 ` [Bug c/67279] " mpolacek at gcc dot gnu.org
2015-08-19 18:59 ` zeccav at gmail dot com
@ 2015-08-19 19:33 ` zeccav at gmail dot com
2015-08-19 19:55 ` manu at gcc dot gnu.org
` (4 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: zeccav at gmail dot com @ 2015-08-19 19:33 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67279
--- Comment #3 from Vittorio Zecca <zeccav at gmail dot com> ---
The following code has UB at lines 4 and 5 but compiles with
-fsanitize=undefined
int main()
{
int test[1],t;
t=test[1];
return test[1];
}
Its execution it delivers four runtime errors from the sanitizer and I
am happy with that
ps.c:4:7: runtime error: index 1 out of bounds for type 'int [1]'
ps.c:4:2: runtime error: load of address 0x7ffcb21195f4 with
insufficient space for an object of type 'int'
0x7ffcb21195f4: note: pointer points here
e0 96 11 b2 fc 7f 00 00 00 00 00 00 00 00 00 00 70 07 40 00 00 00
00 00 e0 ff a1 0d 39 00 00 00
^
ps.c:5:12: runtime error: index 1 out of bounds for type 'int [1]'
ps.c:5:8: runtime error: load of address 0x7ffcb21195f4 with
insufficient space for an object of type 'int'
0x7ffcb21195f4: note: pointer points here
e0 96 11 b2 fc 7f 00 00 00 00 00 00 fc 7f 00 00 70 07 40 00 00 00
00 00 e0 ff a1 0d 39 00 00 00
In short: I like to see gcc -fsanitize=undefined to compile codes it
compiles without sanitation
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug c/67279] -fsanitize=undefined spurious error: initializer element is not constant
2015-08-19 17:06 [Bug c/67279] New: -fsanitize=undefined spurious error: initializer element is not constant zeccav at gmail dot com
` (2 preceding siblings ...)
2015-08-19 19:33 ` zeccav at gmail dot com
@ 2015-08-19 19:55 ` manu at gcc dot gnu.org
2015-08-20 7:15 ` zeccav at gmail dot com
` (3 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: manu at gcc dot gnu.org @ 2015-08-19 19:55 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67279
Manuel López-Ibáñez <manu at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |NEW
Last reconfirmed| |2015-08-19
CC| |manu at gcc dot gnu.org
Ever confirmed|0 |1
--- Comment #4 from Manuel López-Ibáñez <manu at gcc dot gnu.org> ---
The reason for the error is that -fsanitize=undefined replaces 1<<31 with a
call to a sanitizer function __ubsan_handle_shift_out_of_bounds(), however,
this function call is not constant and it cannot be the initializer of a static
variable.
A possible solution could be to give a warning enabled by default (about 1 <<
31 being undefined) and to NOT sanitize expressions that are required to be
constants (since anyway the compiler will not accept them).
In any case, it makes sense that -fsanitize=undefined does not affect whether
the code is compiled or not.
>From gcc-bugs-return-495230-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org Wed Aug 19 20:26:00 2015
Return-Path: <gcc-bugs-return-495230-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org>
Delivered-To: listarch-gcc-bugs@gcc.gnu.org
Received: (qmail 60079 invoked by alias); 19 Aug 2015 20:26:00 -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 60011 invoked by uid 48); 19 Aug 2015 20:25:56 -0000
From: "bergner at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug target/67281] HTM builtins aren't treated as compiler barriers on powerpc
Date: Wed, 19 Aug 2015 20:26:00 -0000
X-Bugzilla-Reason: CC
X-Bugzilla-Type: changed
X-Bugzilla-Watch-Reason: None
X-Bugzilla-Product: gcc
X-Bugzilla-Component: target
X-Bugzilla-Version: 4.9.0
X-Bugzilla-Keywords:
X-Bugzilla-Severity: normal
X-Bugzilla-Who: bergner at gcc dot gnu.org
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: cc
Message-ID: <bug-67281-4-c4CM57wK6j@http.gcc.gnu.org/bugzilla/>
In-Reply-To: <bug-67281-4@http.gcc.gnu.org/bugzilla/>
References: <bug-67281-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: 2015-08/txt/msg01372.txt.bz2
Content-length: 1068
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67281
Peter Bergner <bergner at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |bergner at gcc dot gnu.org
--- Comment #5 from Peter Bergner <bergner at gcc dot gnu.org> ---
(In reply to Tulio Magno Quites Machado Filho from comment #4)
> I disagree with you.
I agree with Tulio.
> Here's an example:
>
> long
> foo (long dest, long *src0, long src1, long tries)
> {
> long i;
> for (i = 0; i < tries; i++)
> {
> __builtin_tbegin (0);
> dest = *src0 + src1;
> if (dest == 13)
> __builtin_tabort(0);
> __builtin_tend (0);
> }
> return dest;
> }
Even better is to change src1 to a pointer too and dereference that within the
transaction. If *src0 and *src1 are two memory locations that should be
updated together and atomically, then allowing them to move past the tbegin.
could break that requirement.
>From gcc-bugs-return-495231-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org Wed Aug 19 20:38:54 2015
Return-Path: <gcc-bugs-return-495231-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org>
Delivered-To: listarch-gcc-bugs@gcc.gnu.org
Received: (qmail 84661 invoked by alias); 19 Aug 2015 20:38:54 -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 84370 invoked by uid 48); 19 Aug 2015 20:38:50 -0000
From: "ville.voutilainen at gmail dot com" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug c++/66606] missing diagnostic on using function main
Date: Wed, 19 Aug 2015 20:38: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: 5.1.0
X-Bugzilla-Keywords: accepts-invalid, diagnostic
X-Bugzilla-Severity: normal
X-Bugzilla-Who: ville.voutilainen at gmail dot com
X-Bugzilla-Status: NEW
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_status cf_reconfirmed_on cc everconfirmed
Message-ID: <bug-66606-4-o6105VGfR6@http.gcc.gnu.org/bugzilla/>
In-Reply-To: <bug-66606-4@http.gcc.gnu.org/bugzilla/>
References: <bug-66606-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: 2015-08/txt/msg01373.txt.bz2
Content-length: 498
https://gcc.gnu.org/bugzilla/show_bug.cgi?idf606
Ville Voutilainen <ville.voutilainen at gmail dot com> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |NEW
Last reconfirmed| |2015-08-19
CC| |ville.voutilainen at gmail dot com
Ever confirmed|0 |1
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug c/67279] -fsanitize=undefined spurious error: initializer element is not constant
2015-08-19 17:06 [Bug c/67279] New: -fsanitize=undefined spurious error: initializer element is not constant zeccav at gmail dot com
` (3 preceding siblings ...)
2015-08-19 19:55 ` manu at gcc dot gnu.org
@ 2015-08-20 7:15 ` zeccav at gmail dot com
2015-08-20 8:38 ` mpolacek at gcc dot gnu.org
` (2 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: zeccav at gmail dot com @ 2015-08-20 7:15 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67279
--- Comment #6 from Vittorio Zecca <zeccav at gmail dot com> ---
On my side it has to do with the C standard.
Compilation with -ansi or -std=c90 is successful.
Compilation with -std=c99 fails.
Compiling with g++ is OK.
The behaviour I would like to see is a warning at compile time
and a runtime error: message at run time.
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug c/67279] -fsanitize=undefined spurious error: initializer element is not constant
2015-08-19 17:06 [Bug c/67279] New: -fsanitize=undefined spurious error: initializer element is not constant zeccav at gmail dot com
` (4 preceding siblings ...)
2015-08-20 7:15 ` zeccav at gmail dot com
@ 2015-08-20 8:38 ` mpolacek at gcc dot gnu.org
2015-09-02 21:01 ` mpolacek at gcc dot gnu.org
2015-09-04 12:38 ` mpolacek at gcc dot gnu.org
7 siblings, 0 replies; 9+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2015-08-20 8:38 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67279
--- Comment #7 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
Yeah, I think I'll change this.
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug c/67279] -fsanitize=undefined spurious error: initializer element is not constant
2015-08-19 17:06 [Bug c/67279] New: -fsanitize=undefined spurious error: initializer element is not constant zeccav at gmail dot com
` (5 preceding siblings ...)
2015-08-20 8:38 ` mpolacek at gcc dot gnu.org
@ 2015-09-02 21:01 ` mpolacek at gcc dot gnu.org
2015-09-04 12:38 ` mpolacek at gcc dot gnu.org
7 siblings, 0 replies; 9+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2015-09-02 21:01 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67279
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
Target Milestone|--- |6.0
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug c/67279] -fsanitize=undefined spurious error: initializer element is not constant
2015-08-19 17:06 [Bug c/67279] New: -fsanitize=undefined spurious error: initializer element is not constant zeccav at gmail dot com
` (6 preceding siblings ...)
2015-09-02 21:01 ` mpolacek at gcc dot gnu.org
@ 2015-09-04 12:38 ` mpolacek at gcc dot gnu.org
7 siblings, 0 replies; 9+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2015-09-04 12:38 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67279
Marek Polacek <mpolacek at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|ASSIGNED |RESOLVED
Resolution|--- |FIXED
--- Comment #9 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
This particular issue is fixed on trunk now. (There are more of these.)
^ permalink raw reply [flat|nested] 9+ messages in thread