On Wed, Sep 4, 2013 at 10:34 PM, Umesh Kalappa wrote:
When p == 0 the program has undefined behaviour,
> Ian,What makes you to say this is undefined ?,Please can you elaborate more
> on this and again tried with below sample
>
>
> int func (int p)
> {
> int x;
> if (p != 1)
On 04/09/13 16:06, Ian Lance Taylor wrote:
> On Wed, Sep 4, 2013 at 6:40 AM, Kirill Tkhai wrote:
>>
>> the following example compiles without warnings:
>>
>> $ cat a.c
>> int func (int p)
>> {
>> int x;
>> if (p != 0)
>> x = 1;
>> return x;
>> }
>>
>> $ gcc
On Wed, Sep 4, 2013 at 8:07 AM, Umesh Kalappa wrote:
> Hi Ian,
> For the below case, when I compile with O3 on X86.Gcc 4.6.3 emits asm with
> ret 1.
>
> Which I feel incorrect.
When p == 0 the program has undefined behaviour, so there is no
incorrect result in that case. When p != 0 the function
On Wed, Sep 4, 2013 at 6:40 AM, Kirill Tkhai wrote:
>
> the following example compiles without warnings:
>
> $ cat a.c
> int func (int p)
> {
> int x;
> if (p != 0)
> x = 1;
> return x;
> }
>
> $ gcc -c a.c -Wall
> (no messages)
>
> Is there no error? Why co
Hi,
the following example compiles without warnings:
$ cat a.c
int func (int p)
{
int x;
if (p != 0)
x = 1;
return x;
}
$ gcc -c a.c -Wall
(no messages)
Is there no error? Why compiler doesn't print a error
about uninitialized variable?
I saw many pieces