<table border="1" cellspacing="0" cellpadding="8">
    <tr>
        <th>Issue</th>
        <td>
            <a href=http://email.email.llvm.org/c/eJylVMmSozgQ_Rp8yTDBUmD7wKGmqhxdh4m5TMQcO4RIQG0h0Vq8zNdPJriWju4-jU0kQqRyee8lre1uzReVFHmSPSfZ42r_QRAOobPKDCCgjdMMtocnLei5d3aCZPfylwy2RQdFVuQQLGgR0AeYhA-0K0wHF4QBQ1iD-ODoNIK006zIV1kD6Jx1Sfn4OXdSZ_drfSyO0TuyWrVkBynJXvf11_phq5WJ1-1gIm3t0irN6J6mPxtlpI4d0ooO_7Fc7_7Sh45Dl4-7ikzOBnoRhH6vDpJit3qlIy2hVxrB2AC9jaZ7K7O8Z_lq8BogKZ_ej5Qvqw_88EuqFwLxt9cvsVjs36PyMAoPLaKBi3UnBrjF3hJlFxVGGwMo7yP6FF7NmUhRg1hY6BBnJDCf4JUbUBIhjCIwUbPwnljSiigkqqs8h-jRbWdnz6rDDu7tQaccEvNOoWfWJWuCI3JmCjCpK5-nmrfqe7QBuXp6zRuvZBZhLG_9jYQy0ZKq7Kkgh5M9k_DMDazBn_LdVuGFEdecLKSJgnFw2jSgAkhh7vrC1dF2H5Dwhmg5xUos1zwqOZJiT9TLhOCjnykXwzGJG2FMviOFpa7EoCSBM6k7OkUKnzl5towGQ8nBwKPxyAkU7yLxItbDSXmEL-LuuoZbWHTYRYnUyxEN8UhL8AQAwuch48OvS4-B0CDsRyFP4C1XLp2aw4Jtqzz3wN0Sd63GieY3MDoXpTWEpT4-ExSZLaiefKlOxfSfjL2YtbB1Qt-QvdioKTYNtLUd52ZP4NEtDvCjOoU5-Y_vSXF8Ek5bv-masjuUB7ERkfhwjVy2B6HP-O-8iU43YwizX0IeedKJttimRCcPvz6_3ViR36hDnutF5LSoyrzON2Ozz8rqsMv3XbGr6S_2KNpSYC3rvu47WW-0aFH7JqnoE1Cs0i0fSVcmICupSKrnzf8vRDVEV5HleZFXRZ2VaVlnGR7kbl_mVX7IH5KHDCehdMpxUuuGjWuWkG0cPL3kKfQfL2k01WAQl7qpwqCCXh7WDqpn-FNc1RQnMHFitZBEfzGupJ_NUmmzlPkf8FLojg>53161</a>
        </td>
    </tr>

    <tr>
        <th>Summary</th>
        <td>
            [clang] Maximum number of include directories?
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            clang:frontend
      </td>
    </tr>

    <tr>
      <th>Assignees</th>
      <td>
      </td>
    </tr>

    <tr>
      <th>Reporter</th>
      <td>
          carlosgalvezp
      </td>
    </tr>
</table>

<pre>
    Hi!

We are doing a bump of Clang from ~October 2021 to latest master and we getting a strange compilation error:

```
/usr/lib/gcc/x86_64-linux-gnu/7.5.0/../../../../include/c++/7.5.0/cstdlib:75:15: fatal error: 'stdlib.h' file not found
#include_next <stdlib.h>
              ^~~~~~~~~~
```

This has been working before without issues. Investigating deeper, I notice that we pass a list of 511 user-provided include directories to clang, with a mix of `-iquote`, `-I` and `-isystem`. If I remove any one include directory from the clang command, then it can compile the code without the above error, which makes me suspect we may have hit a magic limit of 512. 

Does that make sense, is there a limit? Has that limit been reduced/enforced since October 2021? I can try to hack some script and bisect the problem but it will take some time - if this is a known limitation then it would be good to know :) 

Thanks!
/Carlos
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJx1VEmP2zwM_TXOhYjhJc5y8GE6M0HnUPTyAT0WskzbamTJ1ZLl-_Ul7cxStA0MWpEo8vE90o1tb_VnlRR5kj0l2cNivyEIh9BaZXoQ0MRxAtvBoxb0v3N2hGT3_FUG26CDIityCBa0COgDjMIH2hWmhQtCjyEsQXxwdBtB2nFS5KusAXTOuqR8-Jg72Wb3Z_lbHKN3ZLVqyPZSkr3ut9-3m7VWJl7XvYm0tUurNKN3mv5plJE6tkgruvxpft78pQ8thy4fdhWZnA10Igj9hg6SYrd4pQMtoVMawdgAnY2mfYVZ3rN8N3gNkJSPb1fK58UHfvsl1TOR-M_nr1zM9r9BeRiEhwbRwMW6ExPcYGdJsosKg40BlPcRf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