From patchwork Fri Apr 20 09:18:29 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tobias Burnus X-Patchwork-Id: 153984 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) by ozlabs.org (Postfix) with SMTP id C447DB704B for ; Fri, 20 Apr 2012 19:19:16 +1000 (EST) Comment: DKIM? See http://www.dkim.org DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d=gcc.gnu.org; s=default; x=1335518358; h=Comment: DomainKey-Signature:Received:Received:Received:Received: Message-ID:Date:From:User-Agent:MIME-Version:To:Subject: Content-Type:Mailing-List:Precedence:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:Sender:Delivered-To; bh=kST7iTU +ARFVxvv0M/4P0rOpgko=; b=vvAETxojacrSQDb1AZM2VN4pTF8Xiupx5x5SbJf 3daSViX6OlU0J52vHtE9BZi83oqdoG8FXSykTx82b6EMDqrG+LGPVvJXq5cbc89E QsP4tNX6RXFWaGgn3e0T3VuMXKhqHOC9OcZOZEGPShtIFKnEOymz6lXAXZ7O8en5 AKoE= Comment: DomainKeys? See http://antispam.yahoo.com/domainkeys DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=default; d=gcc.gnu.org; h=Received:Received:X-SWARE-Spam-Status:X-Spam-Check-By:Received:Received:Message-ID:Date:From:User-Agent:MIME-Version:To:Subject:Content-Type:Mailing-List:Precedence:List-Id:List-Unsubscribe:List-Archive:List-Post:List-Help:Sender:Delivered-To; b=F6jCxrcYvoA8Qlnp4HoU7jTatM4IjPayPXIwRoWM88P5JjEDRY9E5jJuiOs1BG CMNwO+iLlwmGXQXPAGnHRBPmWUC1+W7n90iRAGd/GRW+M6F5kg9N2602ZYmC5LLB jIBrgBwtK0uK8YaKIiWGgCzRmEq3uaTOevs5hjj7Bv1cc=; Received: (qmail 16311 invoked by alias); 20 Apr 2012 09:18:59 -0000 Received: (qmail 16233 invoked by uid 22791); 20 Apr 2012 09:18:55 -0000 X-SWARE-Spam-Status: No, hits=-1.8 required=5.0 tests=AWL, BAYES_00, RCVD_IN_DNSWL_NONE X-Spam-Check-By: sourceware.org Received: from mx02.qsc.de (HELO mx02.qsc.de) (213.148.130.14) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Fri, 20 Apr 2012 09:18:41 +0000 Received: from [192.168.178.22] (port-92-204-26-242.dynamic.qsc.de [92.204.26.242]) by mx02.qsc.de (Postfix) with ESMTP id 955F324DA2; Fri, 20 Apr 2012 11:18:33 +0200 (CEST) Message-ID: <4F9129E5.30002@net-b.de> Date: Fri, 20 Apr 2012 11:18:29 +0200 From: Tobias Burnus User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:11.0) Gecko/20120328 Thunderbird/11.0.1 MIME-Version: 1.0 To: gcc patches , gfortran Subject: RFC [Patch, Fortran] PR - support "q" for exponents when READing floating-point numbers Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org Dear all, some compilers support using "q" to indicate quad precision, e.g. "4.0q0". Since GCC 4.7, gfortran supports this vendor extension in the source code. However, READing the floating-point number "4.0q0" was not supported. The attached patch adds this support, which some users expect (cf. PR and comp.lang.fortran). Testing other compilers, the result is: - 'q' not supported: g95, NAG f95, PGI, PathScale, Crayftn - 'q' supported: g77, ifort, sunf95 (I don't know which of those compilers support quad precision.) Hence, I am not sure whether one should add support for it. What do you think? Attached is a lightly tested patch and a test case. OK for the trunk after regtesting it? Tobias diff --git a/libgfortran/io/list_read.c b/libgfortran/io/list_read.c index 2024fcd..4d2ce79 100644 --- a/libgfortran/io/list_read.c +++ b/libgfortran/io/list_read.c @@ -1136,6 +1136,8 @@ parse_real (st_parameter_dt *dtp, void *buffer, int length) case 'E': case 'd': case 'D': + case 'q': + case 'Q': push_char (dtp, 'e'); goto exp1; @@ -1449,6 +1451,8 @@ read_real (st_parameter_dt *dtp, void * dest, int length) case 'e': case 'D': case 'd': + case 'Q': + case 'q': goto exp1; case '+': @@ -1546,6 +1550,8 @@ read_real (st_parameter_dt *dtp, void * dest, int length) case 'e': case 'D': case 'd': + case 'Q': + case 'q': goto exp1; case '+': diff --git a/libgfortran/io/read.c b/libgfortran/io/read.c index aa41bc7..32c8b32 100644 --- a/libgfortran/io/read.c +++ b/libgfortran/io/read.c @@ -1026,6 +1026,8 @@ found_digit: case 'E': case 'd': case 'D': + case 'q': + case 'Q': ++p; --w; goto exponent;