------- Comment #1 from pinskia at gcc dot gnu dot org  2009-07-08 18:22 -------
You are violating C/C++ aliasing rules:
          d = (uint8_t*)&aligned; 

          /* This line causes the trouble. */
          *((int*)d) = (int)(*((short*)s));

You are writing into a long long via an int which causes undefined behavior.

There are more aliasing problems in this file too with the loop at:
    printf("before conversion:\n");
And
    printf("after conversion:\n");

As those are accessing an char via a short or an int.

*** This bug has been marked as a duplicate of 21920 ***


-- 

pinskia at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|                            |DUPLICATE


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=40686

Reply via email to