llvm-project icon indicating copy to clipboard operation
llvm-project copied to clipboard

Triple ADT sometimes extracts wrong vendor and os

Open llvmbot opened this issue 16 years ago • 4 comments

Bugzilla Link 6688
Resolution FIXED
Resolved on Oct 15, 2015 23:00
Version trunk
OS Linux
Reporter LLVM Bugzilla Contributor
CC @asl,@echristo

Extended Description

Here are some example triples printed by various gcc versions on my linux machine:

  1. System gcc: x86_64-linux-gnu
  2. 32 bit system gcc: i486-linux-gnu
  3. ACT supplied gcc: x86_64-pc-linux-gnu
  4. 32 bit ACT supplied gcc: i686-pc-linux-gnu
  5. self-built gcc-4.5: x86_64-unknown-linux-gnu
  6. 32 bit self-built gcc-4.5: i686-pc-linux-gnu

If the Triple class is instantiated with 1) or 2) then getVendor and getOS return their 'unknown' value.

llvmbot avatar Mar 24 '10 11:03 llvmbot

If you look at TripleTest.cpp:310 we'll handle these now, so going to call it fixed.

echristo avatar Oct 16 '15 06:10 echristo

I think that triple is doing the right thing here. The frontend should canonicalize the triple even if the user doesn't.

lattner avatar Jul 05 '10 22:07 lattner

Probably the conclusion is that Triple shouldn't parse based on a fixed component position (eg: arch-vendor-os), but instead should examine components and try to recognize each one, asking for each one if it makes sense as an arch value, or an os value, or a vendor value etc. That way it could happily parse gnu-linux-x86_64!

llvmbot avatar Mar 24 '10 12:03 llvmbot

If the Triple class is instantiated with 1) or 2) then getVendor and getOS return their 'unknown' value. Same problem was for i386-mingw32 iirc

asl avatar Mar 24 '10 11:03 asl