<html>
    <head>
      <base href="http://llvm.org/bugs/" />
    </head>
    <body><table border="1" cellspacing="0" cellpadding="8">
        <tr>
          <th>Bug ID</th>
          <td><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW --- - clang emits wrong symbol on PPC32 for std::ostream::write"
   href="http://llvm.org/bugs/show_bug.cgi?id=15726">15726</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>clang emits wrong symbol on PPC32 for std::ostream::write
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>clang
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>trunk
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>Macintosh
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>MacOS X
          </td>
        </tr>

        <tr>
          <th>Status</th>
          <td>NEW
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>normal
          </td>
        </tr>

        <tr>
          <th>Priority</th>
          <td>P
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>C++
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>unassignedclangbugs@nondot.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>fang@csl.cornell.edu
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>dgregor@apple.com, hfinkel@anl.gov, llvmbugs@cs.uiuc.edu
          </td>
        </tr>

        <tr>
          <th>Classification</th>
          <td>Unclassified
          </td>
        </tr></table>
      <p>
        <div>
        <pre>I have a stage1 clang built from gcc-4.0+cmake+shared on powerpc-darwin8 that
I'm using to build stage 2.
The flags I use for stage 2 are: -fno-common -no-integrated-as
(no optimization/debug)

I'm able to compile all translation units for libLLVMSupport, but at link time,
I get:
ld: Undefined symbols:
__ZNSo5writeEPKcl
/usr/libexec/gcc/powerpc-apple-darwin8/4.0.1/libtool: internal link edit
command failed

This symbol is:
% echo __ZNSo5writeEPKcl | c++filt
std::basic_ostream<char, std::char_traits<char> >::write(char const*, long)

However, libstdc++ on my system (PPC, 32b) provides only
std::basic_ostream<char, std::char_traits<char> >::write(char const*, int)

This undefined symbol (stage-2) is being referenced from:
% nm lib/Support/CMakeFiles/LLVMSupport.dir/raw_os_ostream.cpp.o
...
         U __ZNSo5writeEPKcl
...

% file lib/Support/CMakeFiles/LLVMSupport.dir/raw_os_ostream.cpp.o
lib/Support/CMakeFiles/LLVMSupport.dir/raw_os_ostream.cpp.o: Mach-O object ppc
(That's 32b.)

Support/raw_os_ostream.cpp has:
void raw_os_ostream::write_impl(const char *Ptr, size_t Size) {
  OS.write(Ptr, Size);
}


For comparison, during stage 1 (built by system compiler gcc-4.0.1):
% nm lib/Support/CMakeFiles/LLVMSupport.dir/raw_os_ostream.cpp.o 
...
         U __ZNSo5writeEPKci
...

>From libstdc++ (gcc-4.0.1) <ostream>:
      __ostream_type&
      write(const char_type* __s, streamsize __n);

So clang is mistakenly treating the streamsize/size_t argument of
std::ostream::write as long instead of int on a 32b powerpc triple.
size_t should map to int on powerpc 32b, right?</pre>
        </div>
      </p>
      <hr>
      <span>You are receiving this mail because:</span>
      
      <ul>
          <li>You are on the CC list for the bug.</li>
      </ul>
    </body>
</html>