From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 3050 invoked by alias); 11 Dec 2007 19:40:35 -0000 Received: (qmail 2991 invoked by uid 48); 11 Dec 2007 19:40:18 -0000 Date: Tue, 11 Dec 2007 19:40:00 -0000 Message-ID: <20071211194018.2990.qmail@sourceware.org> X-Bugzilla-Reason: CC References: Subject: [Bug fortran/29471] Warn with -std=f95/f2003 when BOZ is used at invalid places In-Reply-To: Reply-To: gcc-bugzilla@gcc.gnu.org To: gcc-bugs@gcc.gnu.org From: "jkrahn at nc dot rr dot com" Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org X-SW-Source: 2007-12/txt/msg00986.txt.bz2 ------- Comment #13 from jkrahn at nc dot rr dot com 2007-12-11 19:40 ------- My previous post here was a bit confused by differences in F95 and F2003, and my misunderstanding of Gfortran's BOZ extension. As I understand the F2003 standard, the expression "INT(z'ff',1)" should produce a range error, for the same reasons as the data statement illustrated in: http://gcc.gnu.org/onlinedocs/gfortran/BOZ-literal-constants.html In practice, I don't think any compilers do this (yet). I thought that F2003 allowed this type of BOZ usage because the KIND was well defined, because the F2003 (draft) standard gives the rule for interpretation as the largest integer kind with DATA statements, but not under REAL(), DBLE(), or CMPLX(). However, I just checked again and found that INT() does require the initial interpretation as the largest integer kind. Unless the final standard differs, it appears that interpretation of BOZ for REAL(), etc., are completely undefined. As far as I can tell, it would be equally valid to interpret a hex value as a binary real value, or just to convert as with integer assignment. Due to being ill-defined, I suggested ignoring the standard. Instead, the right suggestion is an extension which modifies the standard. Maybe there should be a "-f[no-]boz-range-check" to exclude range errors just for the BOZ case. Also, to avoid misleading users into thinking that F2003 BOZ are well-defined, it might be good to warn about any BOZ usage, maybe as part of "-Wsurprising". F2008 draft, it re-defines B/O/Z literals, named BITS instead of BOZ. It seems to be an improvement, but will probably add to the difficulty of supporting multiple standards. -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=29471