Bug 30695 - uint32_t -> uint16_t without warrnings
Summary: uint32_t -> uint16_t without warrnings
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: c (show other bugs)
Version: unknown
: P3 enhancement
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2007-02-03 17:40 UTC by Evgeniy Dushistov
Modified: 2007-02-03 21:15 UTC (History)
1 user (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Evgeniy Dushistov 2007-02-03 17:40:03 UTC
$cat gcc-wrap.c
#include <stdint.h>
#include <stdio.h>

int main()
{
        uint32_t a = 1 << 17;
        uint16_t b = a;
        printf("a: %u, b: %u\n", (unsigned)a, (unsigned)b);
        return 0;
}
$gcc -Wall -Wextra -Wconversion -pedantic gcc-wrap.c
no warrnings
$gcc --version
gcc (GCC) 4.1.1
for example:
$icc --version
iccbin (ICC) 9.1 20060706
$icc -Wall gcc-wrap.c 
gcc-wrap.c(7): remark #810: conversion from "uint32_t={unsigned int}" to "uint16_t={unsigned short}" may lose significant bits
        uint16_t b = a;
                     ^
Comment 1 Andrew Pinski 2007-02-03 20:41:59 UTC
I think this has already been fixed on the trunk with the new -Wconversion behaviors:
http://gcc.gnu.org/wiki/NewWconversion
Comment 2 Evgeniy Dushistov 2007-02-03 21:15:46 UTC
(In reply to comment #1)
> I think this has already been fixed on the trunk with the new -Wconversion
> behaviors:
> http://gcc.gnu.org/wiki/NewWconversion
> 

Thaks for reply, 
I hope to see this feature in near future.