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

[OWBugzilla] [Bug 1164] New: comma operator not working when assigning structures

3 views
Skip to first unread message

bugzill...@www.openwatcom.org

unread,
Apr 18, 2015, 4:29:09 AM4/18/15
to openwatco...@openwatcom.org
http://bugzilla.openwatcom.org/show_bug.cgi?id=1164

Summary: comma operator not working when assigning structures
Product: Open Watcom C/C++ Compiler
Version: OW 1.9
Platform: All (Generic)
OS/Version: Windows 7
Status: UNCONFIRMED
Severity: normal
Priority: --
Component: wcc386.exe
AssignedTo: openwatco...@openwatcom.org
ReportedBy: alexf...@gmail.com


The following program compiles with a warning:
owbg.c(12): Warning! W111: Meaningless use of an expression

And produces wrong result:
a.dummy = 1, b.dummy = 2
a.dummy = 851540, b.dummy = 2


// file: owbg.c
// compile under Windows 7 x64: wcl386 /q /wx owbg.c
#include <stdio.h>

int main(void)
{
struct S { int dummy; } a, b;

a.dummy = 1; b.dummy = 2;
printf("a.dummy = %d, b.dummy = %d\n", a.dummy, b.dummy);

a = (0, b);
printf("a.dummy = %d, b.dummy = %d\n", a.dummy, b.dummy);

return 0;
}


--
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