Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 08 Jul 2013 13:43:58 +0200
From:      dt71@gmx.com
To:        freebsd-current@freebsd.org
Subject:   Re: another -Wunsequenced topic
Message-ID:  <51DAA5FE.4040505@gmx.com>
In-Reply-To: <51D03D27.3020100@gmx.com>
References:  <51CEEC34.2010308@gmx.com> <51D03D27.3020100@gmx.com>

next in thread | previous in thread | raw e-mail | index | archive | help
Well, this turned out to be a semi-false alarm. A week ago, for a short time, there was a bug in Clang. There is no undefined behavior in

   ptr = func(++ptr);,

partially because a function call introduces a sequence point in C, but Clang did not respect this at that time. However,

   x = func1(++ptr) + func2(++ptr);

is compiler-dependent. Additionally, if func() turns out to be a macro, rather than a native function, then undefined behavior (due to unsequencedness) occurs. According to the manpage for ntohl(): "On machines which have a byte order which is the same as the network order, routines are defined as null macros.". This can bite libstand on big-endian systems

So in the end, Clang has accidentally pointed me to an irrelated bug, and induced some unnecessary code changes. lolz



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?51DAA5FE.4040505>