public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "jb at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug fortran/61847] bug in gfortran runtime: digits cut off when reading floating point number
Date: Tue, 04 Nov 2014 12:35:00 -0000	[thread overview]
Message-ID: <bug-61847-4-v9VQFhv03m@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-61847-4@http.gcc.gnu.org/bugzilla/>

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61847

--- Comment #22 from Janne Blomqvist <jb at gcc dot gnu.org> ---
(In reply to Tobias Burnus from comment #21)
> (In reply to Jerry DeLisle from comment #20)
> > Created attachment 33858 [details]
> > Proposed patch
> 
>   /* If the current locale is expecting a comma rather than a decimal
>      point, convert it now.  */
>   if (dtp->u.p.current_unit->decimal_locale == ',')
>     *strchr (buffer, '.') = ',';
> 
> In principle, there are more options than just "," and "."; for instance, in
> Britain, one often uses a centered dot (·) but that's not in the locale.
> 
> Looking at the output of all my locales, I found:
>   ps_AF.utf8:     0٫400000
> as the only locale which doesn't use either a '.' or a ','.

Interesting.. still, Jerry's patch looks like an improvement over the status
quo and should cover the vast majority of cases.

> Still, using a
> code like the following looks more robust.
> 
> /* During _gfortran_st_read/write.  */
> const char *curr_locale = setlocale(LC_ALL, NULL);
> setlocale(LC_ALL, "C");
> 
> ...
> 
> /* During _gfortran_st_read_done/write_done.  */
> setlocale(LC_ALL, curr_locale);

I really don't think we should mess with setlocale(). It changes the
process-wide locale, and if some other thread does something locale-dependent
between our setlocale() calls there will be a bug in the user program which
will be very hard to track down.

As an aside, Jerry's patch suffers from similar issues, as the locale might be
changed between checking the decimal separator (on OPEN) and using some
locale-dependent functions.

The robust solution really is to use strtod_l etc. as previously mentioned.
>From gcc-bugs-return-465709-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org Tue Nov 04 13:50:40 2014
Return-Path: <gcc-bugs-return-465709-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org>
Delivered-To: listarch-gcc-bugs@gcc.gnu.org
Received: (qmail 17774 invoked by alias); 4 Nov 2014 13:50:40 -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 17716 invoked by uid 48); 4 Nov 2014 13:50:35 -0000
From: "aixtools at gmail dot com" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug bootstrap/63714] AIX (5.3.7, xlC v11) fails to bootstrap for gcc 4.9.2, 4.8.3 and 4.7.4
Date: Tue, 04 Nov 2014 13:50:00 -0000
X-Bugzilla-Reason: CC
X-Bugzilla-Type: changed
X-Bugzilla-Watch-Reason: None
X-Bugzilla-Product: gcc
X-Bugzilla-Component: bootstrap
X-Bugzilla-Version: unknown
X-Bugzilla-Keywords:
X-Bugzilla-Severity: normal
X-Bugzilla-Who: aixtools at gmail dot com
X-Bugzilla-Status: RESOLVED
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:
Message-ID: <bug-63714-4-8CdVixKsh5@http.gcc.gnu.org/bugzilla/>
In-Reply-To: <bug-63714-4@http.gcc.gnu.org/bugzilla/>
References: <bug-63714-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: 2014-11/txt/msg00181.txt.bz2
Content-length: 510

https://gcc.gnu.org/bugzilla/show_bug.cgi?idc714

--- Comment #9 from Michael Felt <aixtools at gmail dot com> ---
While I may yet find a bug - my apologies for not better understanding the
installation document.
I see there is a better mail-list (gcc-help) and shall request assistance via
that path.

Thank you again for your assistance!

FYI: gcc-4.7.4 seems to want to finish, but I am probably still not understand
all of the instructions, e.g., where to place binutils so that they get used
properly.


  parent reply	other threads:[~2014-11-04 12:35 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <bug-61847-4@http.gcc.gnu.org/bugzilla/>
2014-07-19  6:19 ` [Bug fortran/61847] bug in gfortran runtime on OSX: " jvdelisle at gcc dot gnu.org
2014-07-21 15:41 ` e2cd58e1 at opayq dot com
2014-07-21 17:50 ` kargl at gcc dot gnu.org
2014-07-21 17:55 ` e2cd58e1 at opayq dot com
2014-07-21 17:58 ` kargl at gcc dot gnu.org
2014-07-21 18:18 ` e2cd58e1 at opayq dot com
2014-07-21 18:26 ` sgk at troutmask dot apl.washington.edu
2014-07-21 18:33 ` e2cd58e1 at opayq dot com
2014-07-21 19:50 ` [Bug fortran/61847] bug in gfortran runtime: " dominiq at lps dot ens.fr
2014-07-22  1:40 ` jvdelisle at gcc dot gnu.org
2014-07-22  2:07 ` e2cd58e1 at opayq dot com
2014-07-22  3:29 ` jvdelisle at gcc dot gnu.org
2014-07-22  4:28 ` jvdelisle at gcc dot gnu.org
2014-07-22  4:46 ` sgk at troutmask dot apl.washington.edu
2014-07-25 22:04 ` jvdelisle at gcc dot gnu.org
2014-08-02 21:12 ` jvdelisle at gcc dot gnu.org
2014-08-19 20:50 ` jb at gcc dot gnu.org
2014-11-03 11:02 ` burnus at gcc dot gnu.org
2014-11-04 12:35 ` jb at gcc dot gnu.org [this message]
2014-11-05 10:51 ` jb at gcc dot gnu.org
2014-11-10  0:18 ` jb at gcc dot gnu.org
2014-11-10  0:21 ` jb 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-61847-4-v9VQFhv03m@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).