Re: __builtin_constant_p and inline assembly constraints

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

 



Simon Kagstrom <simon.kagstrom@xxxxxx> writes:
> When I compile code which uses the above call (puts("Hello, cruel world!\n");,
> const char* argument), I get the following:
..
> I realize that GCC cannot detect all constant values with
> __builtin_constant_p(), but in this case it seems internally
> inconsistent - it apparently emits a constant for the string
> address. Any takes? Would this qualify as a bug?

I think __builtin_constant_p is supposed to return true if its argument
is constant to the _compiler_.

Is a string really a "constant" in that sense?  It's an address which
won't be known until link time, so I'd think not.  The compiler can
generate _code_ that refers the string as a constant, because the
instruction's reference to it will be fixed up at link-time, but still,
it's not a compile-time constant.

-Miles
-- 
Saa, shall we dance?  (from a dance-class advertisement)


[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