[parisc-linux] glibc-2.3.3: a warning with gcc-3.3 become an error with gcc-3.5

Carlos O'Donell carlos at baldric.uwo.ca
Sat Mar 6 15:57:41 MST 2004


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;
> =========><=========

c.



More information about the parisc-linux mailing list