C and C++ parser performing optimizations

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Consider this simple example:

 

  const char * foo() {

    char const * const a = "test";

    char const * const b = a;

    return b;

  }

 

And compile it with

 

gcc -O1 -S test.c -fdump-tree-original

 

you get

 

;; Function foo (null)

;; enabled by -tree-original

 

 

{

  const char * const a = (const char * const) "test";

  const char * const b = (const char * const) "test";

 

    const char * const a = (const char * const) "test";

    const char * const b = (const char * const) "test";

  return (const char *) "test";

}

 

So the parser performs unwanted and uncontrollable optimizations, which I
consider bogus.

 

Any thoughts on this?

 

cheers

 

Stefan




[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux