Linux PARISC architecture development
 help / color / mirror / Atom feed
From: Joel Soete <soete.joel@tiscali.be>
To: Carlos O'Donell <carlos@baldric.uwo.ca>
Cc: parisc-linux@lists.parisc-linux.org
Subject: Re: [parisc-linux] glibc-2.3.3: a warning with gcc-3.3 become an error with gcc-3.5
Date: Sun, 14 Mar 2004 16:21:37 +0000	[thread overview]
Message-ID: <40548691.7090300@tiscali.be> (raw)
In-Reply-To: <20040306225740.GH963@baldric.uwo.ca>

Carlos,

Carlos O'Donell wrote:
> On Sat, Mar 06, 2004 at 10:14:12PM +0000, Joel Soete wrote:
> 
>>Taken into account of your relevant remarks here is my new proposal:
>>=========><=========
>>--- sysdeps/hppa/fpu/feupdateenv.c.orig 2004-03-06 21:18:40.789605000 +0100
>>+++ sysdeps/hppa/fpu/feupdateenv.c      2004-03-06 21:22:21.839605000 +0100
>>@@ -23,15 +23,16 @@
>> int
>> feupdateenv (const fenv_t *envp)
>> {
>>-  unsigned int sw[2];
>>+  struct fenv_t saved_env, new_env;
>>
>>   /* Get the current exception status. */
>>-  __asm__ ("fstd %%fr0,0(%1)" : "=m" (*sw) : "r" (sw));
>>-  sw[0] &= FE_ALL_EXCEPT;
>>-  envp->__status_word = envp->__status_word | sw[0];
> 
> 
> Yeah, this is bad, because 'envp' is const, and we shouldn't be changing
> its value.
> 
> 
>>+  fegetenv(&saved_env);
>>+  saved_env.__status_word &= FE_ALL_EXCEPT;
>>+  new_env.__status_word = envp->__status_word | saved_env.__status_word;
>>+  for (i = 0; i < 7; i++) new_env.__exception[i] = envp->__exception[i];
> 
> 
> Why do you use "new_env" at all? Just use saved_env. Then you don't have
> to have a silly loop to copy the exceptions, they'll already be there.
> Then you can call fesetenv(&saved_env);
>  
> 
>>   /* Install new environment.  */
>>-  fesetenv (envp);
>>+  fesetenv (&new_env);
>>
>>   /* Success.  */
>>   return 0;
>>=========><=========
> 
Taken into account of your remarks here is the final patch:
--- glibc-2.3.3-20040314/sysdeps/hppa/fpu/feupdateenv.c.orig    2003-12-18 04:57:50.000000000 +0100
+++ glibc-2.3.3-20040314/sysdeps/hppa/fpu/feupdateenv.c 2004-03-14 12:06:13.286349000 +0100
@@ -23,15 +23,15 @@
  int
  feupdateenv (const fenv_t *envp)
  {
-  unsigned int sw[2];
+  fenv_t tmp_env;

    /* Get the current exception status. */
-  __asm__ ("fstd %%fr0,0(%1)" : "=m" (*sw) : "r" (sw));
-  sw[0] &= FE_ALL_EXCEPT;
-  envp->__status_word = envp->__status_word | sw[0];
+  fegetenv(&tmp_env);
+  tmp_env.__status_word &= FE_ALL_EXCEPT;
+  tmp_env.__status_word |= envp->__status_word;

    /* Install new environment.  */
-  fesetenv (envp);
+  fesetenv (&tmp_env);

    /* Success.  */
    return 0;
=========><=========

it compiles well with gcc-3.3.

I hope it will not break anything :)

Joel

  parent reply	other threads:[~2004-03-14 16:20 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-03-01 18:43 [parisc-linux] glibc-2.3.3: a warning with gcc-3.3 become an error with gcc-3.5 Joel Soete
2004-03-01 19:38 ` Carlos O'Donell
2004-03-02 14:59   ` Joel Soete
2004-03-02 15:27     ` Matthew Wilcox
2004-04-02 18:03       ` [parisc-linux] [PATCH] glibc-2.3.3 error with debian unstable compiler Carlos O'Donell
2004-04-06 10:46         ` [parisc-linux] " Joel Soete
2004-04-06 13:14           ` Carlos O'Donell
2004-04-20 12:22           ` Joel Soete
2004-04-20 19:35             ` Carlos O'Donell
2004-04-21  6:15               ` Joel Soete
2004-04-21 11:55                 ` Carlos O'Donell
2004-04-27  7:04                   ` Joel Soete
2004-04-27 14:57                     ` Carlos O'Donell
2004-04-27 17:06                       ` Joel Soete
2004-04-27 17:15                         ` Carlos O'Donell
2004-04-28  5:39                           ` Joel Soete
2004-04-28  9:31                             ` Joel Soete
2004-04-28 15:54                               ` Carlos O'Donell
2004-04-28 16:29                                 ` Joel Soete
2004-04-28 17:32                                   ` Joel Soete
2004-03-02 19:50     ` [parisc-linux] glibc-2.3.3: a warning with gcc-3.3 become an error with gcc-3.5 Carlos O'Donell
2004-03-06 22:14       ` Joel Soete
2004-03-06 22:57         ` Carlos O'Donell
2004-03-07 11:07           ` Joel Soete
2004-03-07 20:59             ` Carlos O'Donell
2004-03-14 16:21           ` Joel Soete [this message]
2004-03-14 19:26             ` Carlos O'Donell
2004-03-14 19:44               ` Joel Soete

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=40548691.7090300@tiscali.be \
    --to=soete.joel@tiscali.be \
    --cc=carlos@baldric.uwo.ca \
    --cc=parisc-linux@lists.parisc-linux.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