xlpc fails during test with the Linaro GCC

Bug #607659 reported by Michael Hope
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Linaro GCC
Invalid
High
Unassigned
xplc (Ubuntu)
In Progress
Undecided
Michael Hope

Bug Description

Seen on xplc 0.3.13-2ubuntu4 using gcc-4.4 4.4.4-7ubuntu1~ppa2

http://launchpadlibrarian.net/52093711/buildlog_ubuntu-maverick-armel.xplc_0.3.13-2ubuntu4_FAILEDTOBUILD.txt.gz

Fails during the test phase.

Loïc Minier (lool)
Changed in gcc-linaro:
importance: Undecided → High
milestone: none → 4.4-2010.07-1
Loïc Minier (lool)
Changed in gcc-linaro:
importance: High → Medium
Revision history for this message
Ulrich Weigand (uweigand) wrote :

Confirmed: works with the maverick toolchain, fails with gcc-4.4 4.4.4-7ubuntu1~ppa2.

Changed in gcc-linaro:
status: New → Confirmed
assignee: nobody → Ulrich Weigand (uweigand)
Loïc Minier (lool)
Changed in gcc-linaro:
importance: Medium → High
Revision history for this message
Ulrich Weigand (uweigand) wrote :

Actually, it turned out to be a bug in the xplc source code after all: a violation of aliasing rules.

From include/xplc/uuid.h:

typedef struct _GUID {
  u_int32_t Data1;
  u_int16_t Data2;
  u_int16_t Data3;
  u_int8_t Data4[8];
} GUID;

typedef GUID UUID;

From include/xplc/uuidops.h:

inline int operator==(const UUID& uuid1, const UUID& uuid2) {
    return
      (&uuid1 == &uuid2) ||
      ((static_cast<const u_int32_t*>(&uuid1.Data1)[0] == static_cast<const u_int32_t*>(&uuid2.Data1)[0]) &&
       (static_cast<const u_int32_t*>(&uuid1.Data1)[1] == static_cast<const u_int32_t*>(&uuid2.Data1)[1]) &&
       (static_cast<const u_int32_t*>(&uuid1.Data1)[2] == static_cast<const u_int32_t*>(&uuid2.Data1)[2]) &&
       (static_cast<const u_int32_t*>(&uuid1.Data1)[3] == static_cast<const u_int32_t*>(&uuid2.Data1)[3]));
}

This routine uses lvalues of type u_int32_t to access objects with effective type u_int16_t or u_int8_t, which is not allowed according to the aliasing rules.

In the test case tests/test007.cpp:

  u1 = UUID_null;
  VERIFY(u1 == UUID_null, "u1 is not equal to UUID_null after resetting");

this seems to have caused parts of the initialization of u1 to be scheduled after the use of u1 by the above operator== when inlined. This depends on details of instruction scheduling decisions which have changed in Linaro GCC.

In any case, this is not a compiler problem but needs to be fixed in the original source by something along the lines of either:
- building with -fno-strict-aliasing as a workaround
- comparing all UUID structure elements one by one
- comparing structure contents using memcmp

Michael Hope (michaelh1)
Changed in xplc (Ubuntu):
assignee: nobody → Michael Hope (michaelh1)
Michael Hope (michaelh1)
Changed in xplc (Ubuntu):
status: New → In Progress
Changed in gcc-linaro:
status: Confirmed → Invalid
Loïc Minier (lool)
Changed in gcc-linaro:
assignee: Ulrich Weigand (uweigand) → nobody
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.