octave-maintainers
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Octave on windows testing


From: Olaf Till
Subject: Re: Octave on windows testing
Date: Fri, 11 Mar 2016 22:35:15 +0100
User-agent: Mutt/1.5.23 (2014-03-12)

On Fri, Mar 11, 2016 at 12:50:14PM -0800, Mike Miller wrote:
> On Fri, Mar 11, 2016 at 09:04:06 +0100, Olaf Till wrote:
> > I set -fno-strict-aliasing and didn't assume this option exists in all
> > other compilers.
> > 
> > The reason for this option was that I have macros for accessing memory
> > areas by assuming an arbitrary type for them, using ('C-ish') pointer
> > casts. (This memory area is originally accessed only by a pointer to
> > char.) I don't think it's possible to circumvent this problem using
> > unions, since the union itself would have to be pointer-casted to
> > char, again necessitating -fno-strict-aliasing.
> 
> Even if the union contains the char array for direct memory access? I
> guess a pointer to a relevant part of the code would help here.

I have a std::vector<char>, which is appended to and inserted to by
several callback functions. The appended and inserted objects are of
different types and sizes. Example (changed):

char_vector.resize (char_vector.size () + 4);
*((uint32_t *) &(char_vector.end ()[-4])) = uint32_value;

Well, now that I think about it again, I could use memcpy instead of
direct assignments into the vector. But this would mean a function may
be called where otherwise e.g. only an integer assignment would be
necessary...

> If it were me and I there were no way to work around strict aliasing, I
> would probably eliminate the check for $GXX, try to apply the
> -fno-strict-aliasing option if the compiler allows it, warn or silently
> fail if it doesn't, and wait for someone to report a problem if they
> want to use the package on a different compiler.

But if the compiler silently ignores the option, or treats the option
in an unexpected way, this may mean the database gets filled with
nonsense values and data is lost... So I think we have to be very
accurate here.

Think I'll put my nose into the autoconf documentation again and try
to fiddle together something.

Olaf

-- 
public key id EAFE0591, e.g. on x-hkp://pool.sks-keyservers.net

Attachment: signature.asc
Description: Digital signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]