------- Comment #2 from aoliva at gcc dot gnu dot org  2008-06-26 05:12 -------
It is indeed documented that way, but one gets to wonder if that's desirable. 
Consider that in the original testcase the pointer is converted to a physical
address (integral type) that must not be dereferenced, and that integral type
is then passed on to a function, that calls another function, that ultimately
get the integral-typed arguments into specific registers for a syscall.

The function containing the asm statement can no longer tell which arguments
are pointers and which aren't, because none of them are.

But, as it turns out, GCC has inlined the function containing the asm
statement, as well as its caller, into the function that initialized the data
structure and (in this case) converted the pointer to a physical address.

If it weren't for the inlining, the alias analysis code would have kicked in
and noticed that the pointer escaped in the integral argument.  But because
everything was inlined, no escape was detected, and the asm statement was all
that referenced the pointer-then-integer, and because it was an asm statement
rather than a function call, things went downhill.

Why shouldn't we use the same machinery we use to notice escapes in function
calls to notice escapes in asm statements?

FWIW, there is a work-around: add a do-nothing asm statement that "accesses"
the memory at the time it is converted to a physical address, but that's, well,
not true, and lying to the compiler always comes back and bite us later.


-- 


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

Reply via email to