Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

[OWBugzilla] [Bug 1157] New: Wrongly initialized array of structs

0 views
Skip to first unread message

bugzill...@www.openwatcom.org

unread,
Oct 18, 2014, 9:30:06 AM10/18/14
to openwatco...@openwatcom.org
http://bugzilla.openwatcom.org/show_bug.cgi?id=1157

Summary: Wrongly initialized array of structs
Product: Open Watcom C/C++ Compiler
Version: OW 1.9
Platform: Win32 hosted tools
OS/Version: Windows XP
Status: UNCONFIRMED
Severity: normal
Priority: --
Component: wpp386.exe
AssignedTo: openwatco...@openwatcom.org
ReportedBy: po...@pobox.sk


Compiling the following file initializes backpoints with 24 floats instead of
20 floats (size of tscreenpoint is 5 floats).
That means that backpoints[1] is shifted by 1 float, backpoints[2] is shifted
by 2 floats, ...
Value of backpoints[1].sp_x should be -4.0f, but it's 0.0.
Value of backpoints[1].sp_y should be 1.0f, but it's -4.0f.
...

Command line:
wpp386 /bt=dos4g /d3 /5s /e10 /mf /w1 /fp5 /xs -zp=1 test.cc

File: test.cc
typedef struct {
float sp_x;
float sp_y;
float sp_z;
union {
float sp_data[2];
struct {
float sp_u;
float sp_v;
};
};
} tscreenpoint;

const tscreenpoint backpoints[4] = {
{-4.0f, 1.0f,-15.0f, 0.001f, 0.999f },
{-4.0f, 1.0f, 15.0f, 0.001f, 0.001f },
{22.0f, 1.0f, 15.0f, 0.999f, 0.001f },
{22.0f, 1.0f,-15.0f, 0.999f, 0.999f }};


--
Configure bugmail: http://bugzilla.openwatcom.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.
0 new messages