Mantis Bug Tracker

View Issue Details Jump to Notes ] Issue History ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0007656OCamltypingpublic2017-10-10 23:482017-10-13 21:01
Reporterjpdeplaix 
Assigned Tofrisch 
PrioritynormalSeverityminorReproducibilityalways
StatusresolvedResolutionfixed 
PlatformOSOS Version
Product Version 
Target Version4.06.0+devFixed in Version4.06.0+dev 
Summary0007656: False positives 'unused type/constructor/value' using 4.06.0+beta1
DescriptionThe attached menhir test-case produces false-positive warnings when all warnings are activated.
Steps To ReproduceBy compiling the attached menhir file using ocamlbuild:

ocamlbuild -use-menhir -tag "warn(A-4)" parser.cmo

We get the following warnings:

File "parser.ml", line 2, characters 0-30:
Warning 34: unused type token.
File "parser.ml", line 2, characters 0-30:
Warning 37: unused constructor Test.
File "parser.ml", line 2, characters 0-30:
Warning 37: unused constructor EOF.
File "parser.ml", line 6, characters 4-23:
Warning 32: unused value menhir_begin_marker.
File "parser.ml", line 9, characters 4-11:
Warning 32: unused value xv_main.
File "parser.ml", line 40, characters 4-21:
Warning 32: unused value menhir_end_marker.
Additional InformationThis does not appear with OCaml 4.05.0. Every unused type/constructor/value are used when looking at the code generated by menhir.

Also, I cannot find any of the values listed above, in the generated code (neither menhir_begin_marker, xv_main nor menhir_end_marker).
TagsNo tags attached.
Attached Files? file icon parser.mly [^] (109 bytes) 2017-10-10 23:48 [Show Content]

- Relationships

-  Notes
(0018534)
jpdeplaix (reporter)
2017-10-11 03:53

Ok, with some more tests I realized it was specifically the --infer argument from menhir that causes the issue.
I tested with a small file to avoid menhir and directly use -i from the compiler:

Test file:

type t = Test
let f = fun Test -> ()

The command/result:

$ ocamlc -w A-4 -i test.ml
File "test.ml", line 1, characters 0-13:
Warning 37: constructor Test is never used to build values.
(However, this constructor appears in patterns.)
File "test.ml", line 2, characters 4-5:
Warning 32: unused value f.
type t = Test
val f : t -> unit
(0018536)
frisch (developer)
2017-10-11 09:38

Likely caused by commit e286dbd767, cf 0007620 and the discussion https://github.com/ocaml/ocaml/pull/1317 [^] . The point is that warnings should not be enabled when using -i .
(0018537)
frisch (developer)
2017-10-11 10:06

https://github.com/ocaml/ocaml/pull/1423 [^]

- Issue History
Date Modified Username Field Change
2017-10-10 23:48 jpdeplaix New Issue
2017-10-10 23:48 jpdeplaix File Added: parser.mly
2017-10-11 03:53 jpdeplaix Note Added: 0018534
2017-10-11 09:38 frisch Note Added: 0018536
2017-10-11 10:06 frisch Note Added: 0018537
2017-10-11 10:07 frisch Assigned To => frisch
2017-10-11 10:07 frisch Status new => confirmed
2017-10-11 12:32 frisch Target Version => 4.06.0+dev
2017-10-13 21:01 frisch Status confirmed => resolved
2017-10-13 21:01 frisch Fixed in Version => 4.06.0+dev
2017-10-13 21:01 frisch Resolution open => fixed


Copyright © 2000 - 2011 MantisBT Group
Powered by Mantis Bugtracker