Problem with compiling code with option -O2

This is a discussion on Problem with compiling code with option -O2 within the C Programming forums, part of the General Programming Boards category; May be it is another trap or pitfall of C. But at least, The compiler should give a warning to ...

  1. #16
    Registered User
    Join Date
    Jan 2009
    Posts
    7
    May be it is another trap or pitfall of C. But at least, The compiler should give a warning to programmers.

  2. #17
    Registered User
    Join Date
    Apr 2008
    Posts
    395
    May be it is another trap or pitfall of C.
    I do not agree, this has nothing to do with C, this is an optimization issue and the standard says nothing about it. Plus this is a 'known' problem (or it should be): when you try to optimize (too much) some code, you're no longer ensured to get a correct result (except if you select carefully which optimizations you want and if you know what the optimizer will do). Nobody forces you to use the optimizer, this is a bonus (to use with caution).

    The compiler should give a warning to programmers.
    There is the -Wstrict-aliasing warning despite it does not help much in this case. Last versions of gcc surely have better support (-Wstrict-aliasing=2), but I didn't try.

Page 2 of 2 FirstFirst 12
Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Problem Compiling
    By Flakster in forum C++ Programming
    Replies: 4
    Last Post: 06-13-2006, 02:09 AM
  2. Help on compiling code
    By mattyp1977 in forum C++ Programming
    Replies: 4
    Last Post: 03-26-2006, 05:07 PM
  3. Problem : Threads WILL NOT DIE!!
    By hanhao in forum C++ Programming
    Replies: 2
    Last Post: 04-16-2004, 02:37 PM
  4. Request for comments
    By Prelude in forum A Brief History of Cprogramming.com
    Replies: 15
    Last Post: 01-02-2004, 10:33 AM
  5. Big Code, Little Problem
    By CodeMonkey in forum Windows Programming
    Replies: 4
    Last Post: 10-03-2001, 06:14 PM

Tags for this Thread


1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21