[GHC] #2968: Avoid generating C trigraphs (was: add test for C trigraphs)

GHC ghc-devs at haskell.org
Fri Oct 31 18:04:15 UTC 2014


#2968: Avoid generating C trigraphs
-------------------------------------+-------------------------------------
              Reporter:  duncan      |            Owner:  kchugalinskiy
                  Type:  task        |           Status:  new
              Priority:  lowest      |        Milestone:  7.10.1
             Component:  Compiler    |          Version:  6.10.1
            Resolution:              |         Keywords:  unregisterised
      Operating System:              |     Architecture:  Unknown/Multiple
  Unknown/Multiple                   |       Difficulty:  Unknown
       Type of failure:              |       Blocked By:
  None/Unknown                       |  Related Tickets:
             Test Case:              |
              Blocking:              |
Differential Revisions:              |
-------------------------------------+-------------------------------------
Changes (by thomie):

 * keywords:   => unregisterised


Old description:

> {{{
> main = print "??)"
> }}}
>
> If we compile the above `-fvia-C` then some gcc versions report:
>
> {{{
> /tmp/ghc6084_0/ghc6084_0.hc:99:30:
>      warning: trigraph ??) ignored, use -trigraphs to enable
> }}}
>
> This should make us nervous.
>
> According to the GCC manual if we were ever to use `-std=c89` or any of
> the official C standard compliance modes (ie non-GNU) then we would get
> standard C (cpp) trigraph behavior.
>
> We should therefore add a codeGen/should_run test to make sure that the
> above program does always print `"??)"` and never `"]"`. This test only
> needs to be run for the `-fvia-C` 'ways', optc etc.
>
> It's not an immediate priority but it may trip someone up in future when
> porting or if we make unregisterised C code more standards compliant and
> start using one of the official `-std=` modes. It is unlikely to hit us
> but if it ever did it'd be a real pain to debug.

New description:

 {{{
 main = print "??)"
 }}}

 If we compile the above with an `unregisterised` ghc then some gcc
 versions report:

 {{{
 /tmp/ghc6084_0/ghc6084_0.hc:99:30:
      warning: trigraph ??) ignored, use -trigraphs to enable
 }}}

 This should make us nervous.

 According to the GCC manual if we were ever to use `-std=c89` or any of
 the official C standard compliance modes (ie non-GNU) then we would get
 standard C (cpp) trigraph behavior.

 We should therefore add a codeGen/should_run test to make sure that the
 above program does always print `"??)"` and never `"]"`. This test only
 needs to be run in `unregisterised` mode.

 It's not an immediate priority but it may trip someone up in future when
 porting or if we make unregisterised C code more standards compliant and
 start using one of the official `-std=` modes. It is unlikely to hit us
 but if it ever did it'd be a real pain to debug.

 Edit: replaced `-fvia-c` by [wiki:Building/Unregisterised unregisterised]
 (see 392b7e2a34d26b01ca65648eb5b4a078b0a64e69).

--

--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/2968#comment:16>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler


More information about the ghc-tickets mailing list