NagyDonat wrote: > BTW wouldn't this patch break the semantics of `freopen`? That one should > invalidate the file ptr, right? Could you demonstrate this?
No, `freopen` should _not_ invalidate the file _ptr_, because it modifies the stream object (associating it with a different file) _without_ changing the pointer identity of the stream object. In fact, if you consider the signature, you can see that in ```c FILE *freopen(const char *pathname, const char *mode, FILE *stream); ``` the third parameter takes an _rvalue_ of type `FILE *`, so if you call e.g. `freopen("somefile.txt", "r", stdin)` then this cannot invalidate the `FILE *` pointer stored in the global variable `stdin`. https://github.com/llvm/llvm-project/pull/147766 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits