Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Warning about trigraph on generated assembly code #6373

Open
vicuna opened this issue Apr 17, 2014 · 7 comments
Open

Warning about trigraph on generated assembly code #6373

vicuna opened this issue Apr 17, 2014 · 7 comments

Comments

@vicuna
Copy link

vicuna commented Apr 17, 2014

Original bug ID: 6373
Reporter: @damiendoligez
Assigned to: @mshinwell
Status: resolved (set by @mshinwell on 2017-03-10T11:02:17Z)
Resolution: duplicate
Priority: low
Severity: tweak
OS: Mac OS X
OS Version: 10.7.5
Version: 4.02.0+dev
Target version: undecided
Category: back end (clambda to assembly)

Bug description

String constants that contains C-style trigraphs trigger warnings from the assembler.

I've no idea why the assembler would want to interpret trigraphs or warn about them...

Steps to reproduce

----- foo.ml -----

  let x = "??'"
$ ocamlopt foo.ml
/tmp/camlasm5799be.s:22:10: warning: trigraph ignored [-Wtrigraphs]
        .ascii  "??'"
                 ^
1 warning generated.
$
@vicuna
Copy link
Author

vicuna commented Mar 10, 2017

Comment author: @mshinwell

Fixed by #1093

@vicuna vicuna closed this as completed Mar 10, 2017
@vicuna
Copy link
Author

vicuna commented Oct 4, 2018

Comment author: pmetzger

So far as I can tell, this is not actually fixed. Running the test suite results in an error under MacOS 10.14 with Xcode 10 when I'm testing 4.07.1

@ggreif
Copy link
Contributor

ggreif commented Oct 22, 2022

Yep, the bug is still around:

    ocamlopt mo_frontend/.mo_frontend.objs/native/mo_frontend__Parser.{cmx,o}
/tmp/build257a15.dune/camlasm457c84.s:79915:344: warning: trigraph ignored [-Wtrigraphs]
        .ascii  "\3\2\1\0[[ZYXWVVVUUUTSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSRQQPPOOOOOOOOOOOOOOOOOOOOOOOOOOOOONNNNNNNNNNNNNNNNNNNNNNNNNNNNNMMMMLLKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJIIHHGGGGFFFFEEEDDCCCCCCCCCBBBBBBBBBAAAAAAAAAAAAAAA@@@@@@@@@@@@@@@??>=<<;;;;;;:988776654321000//..--,,,,+++++++**))(((('''&&&&%%%%$$$####\42\42\42!!!    \37\37\37\36\36\36\36\35\35\35\35\34\34\34\33\33\33\32\32\32\32\31\31\31\31\30\30\30\27\27\27\27\26\26\26\25\25\25\24\24\24\23\23\22\21\21\21\20\17\17\16\16\15\15\15\15\15\15\14\14\13\13\13\13\13\13\13\13\13\12\12\12\12\12\12\11\10\10\10\10\10\10\7\6\6\5\5\4\4\4\4"

@damiendoligez
Copy link
Member

@ggreif
Could you tell us more about your OS and your versions of OCaml and C compilers ?

@ggreif
Copy link
Contributor

ggreif commented Jan 19, 2023

@damiendoligez

This is macOS version 12.6.1

$ ocaml --version
The OCaml toplevel, version 4.12.1

I am using nix, so not sure which version of Clang causes the warning, maybe this one:

/nix/store/mx8m9bs2s3wpgir5vf4crzhwgk91zj0d-clang-13.0.1-dev/include/clang/Basic/DiagnosticLexKinds.inc:DIAG(trigraph_ignored, CLASS_WARNING, (unsigned)diag::Severity::Warning, "trigraph ignored", 799, SFINAE_Suppress, false, false, false, 1)

How can I trick ocaml into disclosing this information?

@gasche
Copy link
Member

gasche commented Jan 19, 2023

ocamlc -config has c_compiler and other _c_ related configuration variables.

@ggreif
Copy link
Contributor

ggreif commented Jan 19, 2023

Thanks!

$ ocamlc -config
version: 4.12.1
standard_library_default: /nix/store/2gy98d2l6bp2w2j330z4c7h08nnwbrhy-ocaml-4.12.1/lib/ocaml
standard_library: /nix/store/2gy98d2l6bp2w2j330z4c7h08nnwbrhy-ocaml-4.12.1/lib/ocaml
ccomp_type: cc
c_compiler: clang
ocamlc_cflags: -O2 -fno-strict-aliasing -fwrapv  
ocamlc_cppflags: -D_FILE_OFFSET_BITS=64 -D_REENTRANT 
ocamlopt_cflags: -O2 -fno-strict-aliasing -fwrapv  
ocamlopt_cppflags: -D_FILE_OFFSET_BITS=64 -D_REENTRANT 
bytecomp_c_compiler: clang -O2 -fno-strict-aliasing -fwrapv   -D_FILE_OFFSET_BITS=64 -D_REENTRANT 
native_c_compiler: clang -O2 -fno-strict-aliasing -fwrapv   -D_FILE_OFFSET_BITS=64 -D_REENTRANT 
bytecomp_c_libraries: -lm  -lpthread 
native_c_libraries: -lm 
native_pack_linker: ld -r -o 
ranlib: ranlib
architecture: arm64
model: default
int_size: 63
word_size: 64
system: macosx
asm: /nix/store/pkj7gr8h118xzmi7phkgirrll3vvrssj-clang-wrapper-11.1.0/bin/cc -c
asm_cfi_supported: true
with_frame_pointers: false
ext_exe: 
ext_obj: .o
ext_asm: .s
ext_lib: .a
ext_dll: .so
os_type: Unix
default_executable_name: a.out
systhread_supported: true
host: aarch64-apple-darwin21.6.0
target: aarch64-apple-darwin21.6.0
flambda: false
safe_string: true
default_safe_string: true
flat_float_array: true
function_sections: false
afl_instrument: false
windows_unicode: false
supports_shared_libraries: true
exec_magic_number: Caml1999X029
cmi_magic_number: Caml1999I029
cmo_magic_number: Caml1999O029
cma_magic_number: Caml1999A029
cmx_magic_number: Caml1999Y029
cmxa_magic_number: Caml1999Z029
ast_impl_magic_number: Caml1999M029
ast_intf_magic_number: Caml1999N029
cmxs_magic_number: Caml1999D029
cmt_magic_number: Caml1999T029
linear_magic_number: Caml1999L029

@damiendoligez some of the compiler flags should contain -Wno-trigraphs, presumably...

A quick search only turned up this https://stackoverflow.com/questions/9387166/is-there-a-switch-to-disable-trigraphs-with-clang (maybe the backslash technique could also work).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants