GCC16 or 17: when is the pointed type relevant for emitted assembler code?

Project / Subsystem

gcc / gcc

Date

2026-05-08

Proposer

Basile STARYNKEVITCH <basile@starynkevitch.net>

Source type

public_inbox

Consensus

Under Review

Sentiment

/10

Technical tradeoffs

  • Using void* can reduce type safety and potentially hinder compiler optimizations like type-based alias analysis.
  • Using specific pointer types enables more aggressive optimizations but requires careful type management.

All attributes

project
gcc
subsystem
gcc
patch_id
discussion_id
188b9599fcf75de7cc1f85f642599995e6ec06f5.camel@starynkevitch.net
source_type
public_inbox
title
GCC16 or 17: when is the pointed type relevant for emitted assembler code?
headline
Gcc16 or 17: when is the pointed type relevant for emitted assembler code?
tldr
Basile asks if using `void*` and explicit casts affects assembly code generation in GCC, sparking a discussion on type-based alias analysis.
proposer
Basile STARYNKEVITCH <basile@starynkevitch.net>
consensus
Under Review
outcome
proposed
sentiment_score
technical_tradeoffs
  • Using void* can reduce type safety and potentially hinder compiler optimizations like type-based alias analysis.
  • Using specific pointer types enables more aggressive optimizations but requires careful type management.
series_id
series_role
standalone
series_parts
[]
tags
  • optimization
  • pointers
  • alias analysis
  • TBAA
bugzilla_url
date
2026-05-08T00:00:00.000Z

GCC16 or 17: when is the pointed type relevant for emitted assembler code?

Basile Starynkevitch asks whether using void* for all pointers and casting them at each dereference impacts the generated assembly code in GCC 16 or 17. Richard Biener responds that using specific pointer types enables type-based alias analysis (TBAA), which helps the compiler disambiguate memory accesses. When all pointers are void*, this optimization is not possible.