This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c/21749] gcc generates wrong code


------- Additional Comments From pinskia at gcc dot gnu dot org  2005-05-25 12:05 -------
This is undefined code:
        test_t test_struct[]= {
                {
                        .name = s[i] = get_rand_str(),
                        .num = i++,
                },
                {
                        .name = s[i] = get_rand_str(),
                        .num = i++,
                },
                {
                        .name = s[i] = get_rand_str(),
                        .num = i++,
                },
                {
                        .name = s[i] = get_rand_str(),
                        .num = i++,
                },
                {
                        .name = s[i] = get_rand_str(),
                        .num = i++,
                },
        };

the order which i++ and get_rand_str() is called is undefined.

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|                            |INVALID


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=21749


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]