public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "manu at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug c/67279] -fsanitize=undefined spurious error: initializer element is not constant
Date: Wed, 19 Aug 2015 19:55:00 -0000	[thread overview]
Message-ID: <bug-67279-4-OmTbuQ9lLO@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-67279-4@http.gcc.gnu.org/bugzilla/>

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


  parent reply	other threads:[~2015-08-19 19:55 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-08-19 17:06 [Bug c/67279] New: " 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 [this message]
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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-67279-4-OmTbuQ9lLO@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).