strict aliasing issue in action

Lisandro Dalcin dalcinl at
Mon Oct 1 09:54:11 CDT 2007

Please, try the small example attached. You will see in action the
issues related to strict aliasing with current PETSc state. The
example is perhpas a bit artificial, but you know, bad things can
always happen, and worse if that happens with optimization, as it is
much hard to debug.

- Use a optimized build for $PETSC_ARCH with a recent GCC (I used
4.1.1 in my Fedora 6 box)

- First, build the example disabling strict aliasing. Run it, and you
will get the expected output.

$ make SA_FLAG=-fno-strict-aliasing
$ main
v->refct: 1

- Next, build the example enabling strict aliasing. Run it, and you
will get unexpected output
$ make SA_FLAG=-fstrict-aliasing
$ main
v->refct: 11

I realy thing we have to take this seriously. That the reason I'm
trying to solve this at home. I'm near to finishing it. After that, I
would ask you to create a clone in your server, in order to push it
and you test it.

Lisandro Dalcín
Centro Internacional de Métodos Computacionales en Ingeniería (CIMEC)
Instituto de Desarrollo Tecnológico para la Industria Química (INTEC)
Consejo Nacional de Investigaciones Científicas y Técnicas (CONICET)
PTLC - Güemes 3450, (3000) Santa Fe, Argentina
Tel/Fax: +54-(0)342-451.1594

More information about the petsc-dev mailing list