Re: for review: sys/dev/md/md.c patch

From: Luigi Rizzo <rizzo_at_icir.org>
Date: Mon, 30 Jan 2006 04:54:47 -0800
On Mon, Jan 30, 2006 at 01:12:49PM +0100, Oliver Fromme wrote:
> Luigi Rizzo <rizzo_at_icir.org> wrote:
>  > just discovered, trying to resurrect picobsd on -current,
>  > that the compiler in 6.x/7.x has become smart and, at least
>  > with the default compilation flags, will optimize out
>  > the "end_mfs_root" string from the object.
> 
> Shouldn't it be sufficient to declare the string as volatile?
> That should prevent it from being optimized by the compiler.

maybe.
but packing both into the same struct also solves the issue
of compiler potentially rearranging the variables in memory,
and since we want them contiguous, the approach i suggested is
probably more appropriate (with compilers becoming smarter
and smarter, that is...)

cheers
luigi

> (I'm not questioning your solution, mind you.  I just wonder
> if "volatile" would do the job.  So far I've used volatile
> for things like sig_atomic_t only.)
> 
> Best regards
>    Oliver
> 
> -- 
> Oliver Fromme,  secnetix GmbH & Co. KG, Marktplatz 29, 85567 Grafing
> Dienstleistungen mit Schwerpunkt FreeBSD: http://www.secnetix.de/bsd
> Any opinions expressed in this message may be personal to the author
> and may not necessarily reflect the opinions of secnetix in any way.
> 
> "When your hammer is C++, everything begins to look like a thumb."
>         -- Steve Haflich, in comp.lang.c++
> _______________________________________________
> freebsd-current_at_freebsd.org mailing list
> http://lists.freebsd.org/mailman/listinfo/freebsd-current
> To unsubscribe, send any mail to "freebsd-current-unsubscribe_at_freebsd.org"
Received on Mon Jan 30 2006 - 11:54:48 UTC

This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:38:51 UTC