From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 5617 invoked by alias); 22 May 2014 15:11:13 -0000 Mailing-List: contact cgen-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cgen-owner@sourceware.org Received: (qmail 5594 invoked by uid 89); 22 May 2014 15:11:12 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.7 required=5.0 tests=AWL,BAYES_00,RCVD_IN_DNSWL_LOW,RP_MATCHES_RCVD,SPF_HELO_PASS,SPF_PASS autolearn=ham version=3.3.2 X-Spam-User: qpsmtpd, 2 recipients X-HELO: elastic.org Received: from elastic.org (HELO elastic.org) (69.20.226.105) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-GCM-SHA384 encrypted) ESMTPS; Thu, 22 May 2014 15:11:10 +0000 Received: from super.elastic.org (localhost [127.0.0.1]) by elastic.org (8.14.7/8.14.7) with ESMTP id s4MF9xMm013591 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Thu, 22 May 2014 11:09:59 -0400 Received: (from fche@localhost) by super.elastic.org (8.14.7/8.14.7/Submit) id s4MF9uFu013577; Thu, 22 May 2014 11:09:56 -0400 Date: Thu, 22 May 2014 15:11:00 -0000 From: "Frank Ch. Eigler" To: Stefan Kristiansson Cc: cgen@sourceware.org, Alan Modra , fche@sourceware.org, Christian Svensson , Pierre Muller , "Maciej W. Rozycki" Subject: Re: [PATCH] Make large enum constants unsigned Message-ID: <20140522150956.GC4031@elastic.org> References: <20140522052921.GA30609@chokladfabriken.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20140522052921.GA30609@chokladfabriken.org> User-Agent: Mutt/1.5.21 (2010-09-15) X-SW-Source: 2014-q2/txt/msg00011.txt.bz2 Hi - > this fixes a bug noted in two threads on the binutils mailing list: > https://sourceware.org/ml/binutils/2014-05/msg00152.html > https://sourceware.org/ml/binutils/2014-05/msg00195.html > > Both threads describe the problem pretty well, but the gist of it > is that constants are generated that will be interpreted as signed. > > 2014-05-22 Stefan Kristiansson > > * enum.scm (gen-enum-decl): Emit 'ULL' after constants larger than > #x80000000 > [...] > - (number->string (cadr e)) > + (string-append (number->string (cadr e)) > + (if (> (cadr e) > + #x80000000) > + "ULL" "")) Have you thought of having cgen emit it as (string-append "(signed int)" (number->string (cadr e))) ... or even find a number->string conversion function that takes into account the destionation language's encoding constraints. - FChE