Re: [RFC] Turning off trapping-math for C and C++ front-ends by default

Project / Subsystem

gcc / gcc

Date

2026-07-03

Proposer

Richard Biener <rguenther@suse.de>

Source type

public_inbox

Consensus

Proposed

Sentiment

/10

Technical tradeoffs

  • Disabling trapping math by default offers potential performance gains but risks incorrect behavior if FENV_ACCESS is used.
  • Accurately modeling FP exception flags requires significant changes to GCC's intermediate representations and optimization passes.

All attributes

project
gcc
subsystem
gcc
patch_id
discussion_id
5rnrsrp4-po1s-npo5-7p50-1209p96nnrq3@fhfr.qr
source_type
public_inbox
title
Re: [RFC] Turning off trapping-math for C and C++ front-ends by default
headline
Turning off trapping-math for C and C++ front-ends by default
tldr
GCC developers discuss implications of disabling trapping math by default and challenges in accurately modeling floating-point exception flags.
proposer
Richard Biener <rguenther@suse.de>
consensus
Proposed
outcome
proposed
sentiment_score
technical_tradeoffs
  • Disabling trapping math by default offers potential performance gains but risks incorrect behavior if FENV_ACCESS is used.
  • Accurately modeling FP exception flags requires significant changes to GCC's intermediate representations and optimization passes.
series_id
5rnrsrp4-po1s-npo5-7p50-1209p96nnrq3@fhfr.qr
series_role
cover
series_parts
[]
tags
  • gcc
  • floating-point
  • optimization
  • C
  • C++
bugzilla_url
date
2026-07-03T00:00:00.000Z

Re: [RFC] Turning off trapping-math for C and C++ front-ends by default

This exchange delves into the complexities of GCC’s handling of floating-point exceptions and the implications of disabling trapping math (-fno-trapping-math) by default for C and C++ front-ends. Richard Biener suggests introducing internal functions for IEEE flag operations to better model per-operation exception behavior, acknowledging difficulties with GIMPLE and global state like ‘errno’. The discussion highlights the trade-offs between optimization levels, frontend representations, and accurate FPU state management.