This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: Is it a bug when use “<<”if the operator is out of the size "0~63"
- From: Jonathan Wakely <jwakely dot gcc at gmail dot com>
- To: Yang Yueming <yueming dot yang at huawei dot com>
- Cc: "gcc at gcc dot gnu dot org" <gcc at gcc dot gnu dot org>
- Date: Fri, 24 Feb 2012 09:11:45 +0000
- Subject: Re: Is it a bug when use “<<”if the operator is out of the size "0~63"
- Authentication-results: mr.google.com; spf=pass (google.com: domain of jwakely.gcc@gmail.com designates 10.152.110.234 as permitted sender) smtp.mail=jwakely.gcc@gmail.com; dkim=pass header.i=jwakely.gcc@gmail.com
- References: <2ACD72112798CE4AAB7C779F44B073880775F155@szxeml536-mbx.china.huawei.com>
This question is not appropriate for this mailing list, questions
about using GCC should be sent to the gcc-help@gcc.gnu.org list,
please take any follow up there, thanks.
On 24 February 2012 08:34, Yang Yueming wrote:
>
> The result of xyz should be "0"ïbut it is "2468acf123579bc" ,same as Âxyz = abc << 1,Why?
The C standard says it's undefined behaviour:
"If the value of the right operand is negative or is greater than or
equal to the width of the promoted left operand, the behavior is
undefined."