From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 12374 invoked by alias); 21 Sep 2013 19:55:09 -0000 Mailing-List: contact gcc-help-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-help-owner@gcc.gnu.org Received: (qmail 12365 invoked by uid 89); 21 Sep 2013 19:55:09 -0000 Received: from mail-pa0-f50.google.com (HELO mail-pa0-f50.google.com) (209.85.220.50) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-SHA encrypted) ESMTPS; Sat, 21 Sep 2013 19:55:09 +0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.9 required=5.0 tests=BAYES_00,FREEMAIL_FROM,NO_RELAYS autolearn=ham version=3.3.2 X-HELO: mail-pa0-f50.google.com Received: by mail-pa0-f50.google.com with SMTP id fb1so739977pad.9 for ; Sat, 21 Sep 2013 12:55:07 -0700 (PDT) MIME-Version: 1.0 X-Received: by 10.66.27.43 with SMTP id q11mr15488970pag.97.1379793307651; Sat, 21 Sep 2013 12:55:07 -0700 (PDT) Received: by 10.70.44.67 with HTTP; Sat, 21 Sep 2013 12:55:07 -0700 (PDT) In-Reply-To: <20130921185052.GG3086@a.lan> References: <20130921164609.GC3086@a.lan> <20130921174229.GD3086@a.lan> <20130921185052.GG3086@a.lan> Date: Sat, 21 Sep 2013 19:55:00 -0000 Message-ID: Subject: Re: how to make gcc warn about arithmetic signed overflow From: =?UTF-8?Q?J=C4=99drzej_Dudkiewicz?= To: wempwer@gmail.com Cc: gcc-help Content-Type: text/plain; charset=UTF-8 X-IsSubscribed: yes X-SW-Source: 2013-09/txt/msg00144.txt.bz2 >> No, that's not true. You can't change the value of a const object in a >> valid program. > > I think I can but it may cause an undefined behavior: Note, that Jonathan wrote "in a valid program". Your program is not valid, as it contains undefined behaviour - you change const int via pointer to non-const int.